mirror of
https://github.com/bnowakow/GT7-Scripts.git
synced 2026-01-27 21:46:00 +00:00
add versions of clubman and tokyo
This commit is contained in:
BIN
bnowakow/old versions/5 Tokyo/GT7-TOKYO-9.2/Assets/GT7_Tokyo.ico
Normal file
BIN
bnowakow/old versions/5 Tokyo/GT7-TOKYO-9.2/Assets/GT7_Tokyo.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
bnowakow/old versions/5 Tokyo/GT7-TOKYO-9.2/Assets/tokyo_gui.png
Normal file
BIN
bnowakow/old versions/5 Tokyo/GT7-TOKYO-9.2/Assets/tokyo_gui.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.1 KiB |
313
bnowakow/old versions/5 Tokyo/GT7-TOKYO-9.2/GT7_Tokyo.AHK
Normal file
313
bnowakow/old versions/5 Tokyo/GT7-TOKYO-9.2/GT7_Tokyo.AHK
Normal file
@@ -0,0 +1,313 @@
|
||||
#Persistent
|
||||
#NoEnv
|
||||
#MaxHotkeysPerInterval 99000000
|
||||
#HotkeyInterval 99000000
|
||||
#KeyHistory 0
|
||||
#Include Lib\Gdip.ahk
|
||||
#Include Lib\AHK-ViGEm-Bus.ahk
|
||||
#Include Lib\__utility__.ahk
|
||||
#Include Lib\__controller_functions__.ahk
|
||||
#Include Mod\TokyoDetections.ahk
|
||||
#Include Races\Tokyo.ahk
|
||||
|
||||
hModule := DllCall("LoadLibrary", "Str", A_LineFile "\..\Lib\SuperSleep.dll", "Ptr")
|
||||
SuperSleep := DllCall("GetProcAddress", "Ptr", DllCall("GetModuleHandle", "Str", A_LineFile "\..\Lib\SuperSleep.dll", "Ptr"), "AStr", "super_sleep", "Ptr")
|
||||
|
||||
ListLines Off
|
||||
Process, Priority, , A
|
||||
SetBatchLines, -1
|
||||
SetKeyDelay, -1, -1
|
||||
SetMouseDelay, -1
|
||||
SetDefaultMouseSpeed, 0
|
||||
SendMode Input
|
||||
|
||||
SetWorkingDir %A_ScriptDir%
|
||||
DetectHiddenWindows, On
|
||||
#Persistent
|
||||
|
||||
Global script_start := A_TickCount
|
||||
Global remote_play_offsetY := 71
|
||||
Global racecounter := 0
|
||||
Global resetcounter := 0
|
||||
Global color_pitstop1 := 0xFFFFFF
|
||||
Global color_restart := 0x6D5223
|
||||
Global hairpin_delay := 0
|
||||
|
||||
Global TelegramBotToken := ""
|
||||
Global TelegramChatID := ""
|
||||
Global location := ""
|
||||
Global TokyoLapCount := 1
|
||||
|
||||
|
||||
|
||||
SetFormat, integerfast, d
|
||||
ps_win_width := 640
|
||||
ps_win_height := 360
|
||||
IniRead, hairpin_delay, config.ini, Vars, hairpin_delay, 0
|
||||
IniRead, color_pitstop1, config.ini, Vars, color_pitstop1, 0
|
||||
IniRead, RaceCounterTotal, config.ini, Stats, racecountertotal, 0
|
||||
IniRead, ResetCounterTotal, config.ini, Stats, resetcountertotal, 0
|
||||
IniRead, TelegramBotToken, config.ini, API, TelegramBotToken, 0
|
||||
IniRead, TelegramChatID, config.ini, API, TelegramChatID, 0
|
||||
SetFormat, FloatFast, 0.2
|
||||
creditcountertotal := 835000*racecountertotal/1000000
|
||||
|
||||
Global controller := new ViGEmDS4()
|
||||
controller.SubscribeFeedback(Func("OnFeedback"))
|
||||
OnFeedback(largeMotor, smallMotor, lightbarColor){
|
||||
}
|
||||
|
||||
;- GUI 1 (MAIN) -------------------------------------------------------------------------------------------------
|
||||
Icon = Assets\GT7_Tokyo.ico
|
||||
Menu, Tray, Icon, %Icon%
|
||||
Gui, -Caption
|
||||
Gui, Add, Picture, x0 y0 w650 h207 , Assets\tokyo_gui.png
|
||||
Gui, Add, Button, x222 y82 w410 h80 default gButtonStart, START
|
||||
Gui, Add, Progress, x0 y54 w641 h12 RaceProgress vRaceProgress -Smooth, 0
|
||||
Gui, Font, S8 CDefault Bold, Verdana
|
||||
Gui, Add, Text, x440 y3 w160 h20 RaceCounterTotal +BackgroundTrans, // ALL TIME
|
||||
Gui, Font, ,
|
||||
Gui, Add, Text, x440 y23 w160 h20 RaceCounterTotal vracecountertotal +BackgroundTrans, Races completed: %racecountertotal%
|
||||
Gui, Add, Text, x440 y38 w160 h20 ResetCounterTotal vresetcountertotal +BackgroundTrans, Races failed: %resetcountertotal%
|
||||
Gui, Add, Text, x550 y38 w160 h20 CreditCounterTotal vcreditcountertotal +BackgroundTrans, Credits: %creditcountertotal% M
|
||||
Gui, Font, S8 CDefault Bold, Verdana
|
||||
Gui, Add, Text, x220 y3 w300 h20 RaceSession vracesession +BackgroundTrans, // SESSION
|
||||
Gui, Font, ,
|
||||
Gui, Add, Text, x220 y23 w160 h20 RaceCounterSession vracecountersession +BackgroundTrans, Races completed: 0
|
||||
Gui, Add, Text, x220 y38 w160 h20 ResetCounterSession vresetcountersession +BackgroundTrans, Races failed: 0
|
||||
Gui, Add, Text, x330 y23 w160 h20 CreditCounterSession vcreditcountersession +BackgroundTrans, Credits: 0
|
||||
Gui, Add, Text, x330 y38 w160 h20 CreditAVG vcreditavg +BackgroundTrans, Avg./h: 0
|
||||
Gui, Add, Text, x10 y38 w150 h20 CounterLap vcurrentlap +BackgroundTrans, Current Lap: 0/12
|
||||
Gui, Add, Text, x10 y23 w150 h20 CurrentLoop vcurrentloop +BackgroundTrans, Current Location: -
|
||||
Gui, Add, Button, x222 y172 w300 h20 default gGUIReset, Reset
|
||||
Gui, Add, Button, x531 y172 w101 h20 default gGUIClose, Exit
|
||||
Gui, Add, Button, x12 y82 w200 h20 default gMachineSettingsWindow, Settings: Machine/Setup
|
||||
Gui, Add, Button, x12 y112 w200 h20 default gIngameSettingsWindow, Settings: Ingame (wip)
|
||||
Gui, Add, Button, x12 y142 w200 h20 default gRiskRewardWindow, Settings: Risk/Reward (wip)
|
||||
Gui, Add, Button, x12 y172 w200 h20 default gNotificationsWindow, Settings: Notifications/API
|
||||
Gui, Font, S8 CDefault Bold, Verdana
|
||||
Gui, Add, Text, x10 y3 w620 h20 +BackgroundTrans, // TOKYO CONTROL CENTER
|
||||
Gui, Add, Statusbar, -Theme Backgroundeeeeee ;#eeeeee, no typo
|
||||
SB_SetParts(80,270,190)
|
||||
SB_SetText(" beta 9.2 ",1)
|
||||
SB_SetText(" by problemz.",4)
|
||||
Gui, Show, x8 y532 h225 w640, GT7 Tokyo // by problemz
|
||||
guicontrol,, CurrentLoop, Press START, go go!
|
||||
;- GUI 2 (MACHINE/SETUP) ----------------------------------------------------------------------------------------
|
||||
Gui, 2: Add, Picture, x0 y0 w650 h210 , Assets\tokyo_gui.png
|
||||
Gui, 2: Add, Text, x10 y14 w200 h20 +BackgroundTrans , Hairpin Turn Delay:
|
||||
Gui, 2: Font, ,
|
||||
Gui, 2: Add, Text, x170 y14 w200 h20 +BackgroundTrans , (ms)
|
||||
Gui, 2: Add, Slider, x220 y10 w300 h51 vsliderhairpindelay Range0-800 Thick40 +ToolTip TickInterval50 gSliderMove,%hairpin_delay%
|
||||
Gui, 2: Add, Edit, x106 y11 w60 vtxthairpindelay gtextchanged, %hairpin_delay%
|
||||
Gui, 2: Add, Text, x10 y40 w200 h20 +BackgroundTrans , Lower = slower PC // Higher = faster PC
|
||||
Gui, 2: Add, Button, x530 y11 w100 h51 +BackgroundTrans gSaveToIni, Save
|
||||
|
||||
Gui, 2: Add, Button, x10 y80 w200 h40 gPit1Color, Stuck in pit `n(Only click when at tire selection menu)
|
||||
;- GUI 3 (INGAME) -----------------------------------------------------------------------------------------------
|
||||
Gui, 3: Add, Picture, x0 y0 w650 h177 , Assets\tokyo_gui.png
|
||||
;- GUI 4 (RISK/REWARD) ------------------------------------------------------------------------------------------
|
||||
Gui, 4: Add, Picture, x0 y0 w650 h177 , Assets\tokyo_gui.png
|
||||
;- GUI 5 (NOTIFICATIONS/API) ------------------------------------------------------------------------------------
|
||||
Gui, 5: Add, Picture, x0 y0 w650 h400 , Assets\tokyo_gui.png
|
||||
Gui, 5: Add, Text, x10 y14 w205 h20 +BackgroundTrans , Telegram Bot Token:
|
||||
Gui, 5: Add, Edit, x116 y11 w400 vTelegramBotToken Password, %TelegramBotToken%
|
||||
Gui, 5: Add, Text, x10 y44 w205 h20 +BackgroundTrans , Telegram Chat ID:
|
||||
Gui, 5: Add, Edit, x116 y41 w400 vTelegramChatID Password, %TelegramChatID%
|
||||
Gui, 5: Add, Button, x530 y11 w100 h51 +BackgroundTrans gSaveToIni, Save
|
||||
Return
|
||||
|
||||
MachineSettingsWindow:
|
||||
|
||||
if (GetKeyState("LShift", "P") AND GetKeyState("LAlt", "P")){
|
||||
goto, MouseColor
|
||||
}
|
||||
else{
|
||||
Gui, 2: Show, x6 y757 w639 h133, Settings: Machine/Setup
|
||||
}
|
||||
|
||||
return
|
||||
|
||||
IngameSettingsWindow:
|
||||
Gui, 3: Show, x6 y757 w639 h35, Settings: Ingame
|
||||
return
|
||||
|
||||
RiskRewardWindow:
|
||||
Gui, 4: Show, x6 y757 w639 h35, Settings: Risk/Reward
|
||||
return
|
||||
|
||||
NotificationsWindow:
|
||||
Gui, 5: Show, x6 y757 w639 h70, Settings: Notifications/API
|
||||
return
|
||||
|
||||
SliderMove:
|
||||
Gui, Submit, nohide
|
||||
GuiControl,, txthairpindelay, %sliderhairpindelay%
|
||||
Return
|
||||
|
||||
SaveToIni:
|
||||
Gui, Submit, Hide
|
||||
IniWrite, %txthairpindelay%, config.ini,Vars, hairpin_delay
|
||||
IniWrite, %TelegramBotToken%, config.ini,API, TelegramBotToken
|
||||
IniWrite, %TelegramChatID%, config.ini,API, TelegramChatID
|
||||
return
|
||||
|
||||
TextChanged:
|
||||
guiControlGet, txtvar,, txthairpindelay
|
||||
if (txtvar > 800)
|
||||
{
|
||||
GuiControl,, txthairpindelay, 800
|
||||
}
|
||||
|
||||
GuiControl,, sliderhairpindelay, %txtvar%
|
||||
return
|
||||
|
||||
Pit1Color:
|
||||
MsgBox, 4,, Do you really wanna set a new Pitstop color?
|
||||
IfMsgBox Yes
|
||||
{
|
||||
gosub, GrabRemotePlay
|
||||
color_pitstop1 := PixelColorSimple(199, 315+remote_play_offsetY)
|
||||
IniWrite, %color_pitstop1%, config.ini,Vars, color_pitstop1
|
||||
}
|
||||
return
|
||||
|
||||
ButtonStart:
|
||||
SetTimer, UpdateTimer, 1000
|
||||
Gui, Submit, NoHide
|
||||
id := ""
|
||||
SetKeyDelay, 10
|
||||
Process, priority, , High
|
||||
gosub, GrabRemotePlay
|
||||
if (id = "")
|
||||
return
|
||||
gosub, PauseLoop
|
||||
CoordMode, Pixel, Screen
|
||||
CoordMode, ToolTip, Screen
|
||||
loop {
|
||||
Press_X()
|
||||
Race_Tokyo()
|
||||
}
|
||||
|
||||
PixelTuning:
|
||||
x_ratio := ps_win_width/640
|
||||
y_ratio := ps_win_height/360
|
||||
return
|
||||
|
||||
GrabRemotePlay:
|
||||
WinGet, remotePlay_id, List, ahk_exe RemotePlay.exe
|
||||
if (remotePlay_id = 0)
|
||||
{
|
||||
MsgBox, PS4 Remote Play not found
|
||||
return
|
||||
}
|
||||
Loop, %remotePlay_id%
|
||||
{
|
||||
id := remotePlay_id%A_Index%
|
||||
WinGetTitle, title, % "ahk_id " id
|
||||
If InStr(title, "PS Remote Play")
|
||||
break
|
||||
}
|
||||
WinMove, ahk_id %id%,, 0, 0, 640, 540
|
||||
|
||||
ControlFocus,, ahk_class %remotePlay_class%
|
||||
WinActivate, ahk_id %id%
|
||||
GetClientSize(remotePlay_id5, ps_win_width, ps_win_height)
|
||||
gosub, PixelTuning
|
||||
return
|
||||
|
||||
PauseLoop:
|
||||
controller.Buttons.Cross.SetState(false)
|
||||
controller.Buttons.Square.SetState(false)
|
||||
controller.Buttons.Triangle.SetState(false)
|
||||
controller.Buttons.Circle.SetState(false)
|
||||
controller.Buttons.L1.SetState(false)
|
||||
controller.Buttons.L2.SetState(false)
|
||||
controller.Axes.L2.SetState(0)
|
||||
controller.Buttons.R1.SetState(false)
|
||||
controller.Buttons.R2.SetState(false)
|
||||
controller.Axes.R2.SetState(0)
|
||||
controller.Buttons.RS.SetState(false)
|
||||
controller.Axes.RX.SetState(50)
|
||||
controller.Axes.RY.SetState(50)
|
||||
controller.Buttons.LS.SetState(false)
|
||||
controller.Axes.LX.SetState(50)
|
||||
controller.Axes.LY.SetState(50)
|
||||
controller.Dpad.SetState("None")
|
||||
return
|
||||
|
||||
ResetRace:
|
||||
|
||||
FormatTime, TGTime,, MM/dd hh:mm:ss
|
||||
FileAppend, %TGTime%: Race failed - Lap %TokyoLapCount% - %location%.`n, log.txt
|
||||
url := "https://api.telegram.org/bot" TelegramBotToken "/sendMessage?text=" TGTime ": Race failed - Lap " TokyoLapCount " - " location ".&chat_id=" TelegramChatID
|
||||
hObject:=ComObjCreate("WinHttp.WinHttpRequest.5.1")
|
||||
hObject.Open("GET",url)
|
||||
hObject.Send()
|
||||
|
||||
SB_SetText(" - RESET INITIATED -",2)
|
||||
guicontrol,, CurrentLoop, Something went wrong, reseting.
|
||||
controller.Axes.LX.SetState(50)
|
||||
Press_Options()
|
||||
Sleep(1000)
|
||||
Press_Right()
|
||||
Sleep(500)
|
||||
Press_X()
|
||||
controller.Axes.LX.SetState(65)
|
||||
IniRead, ResetCounterTotal, config.ini, Stats, resetcountertotal, 0
|
||||
SetFormat, integerfast, d
|
||||
resetcounter++
|
||||
resetcountertotal++
|
||||
IniWrite, %resetcountertotal%, config.ini,Stats, ResetCounterTotal
|
||||
guicontrol,, ResetCounterTotal, Races failed: %resetcountertotal%
|
||||
guicontrol,, ResetCounterSession, Races failed: %resetcounter%
|
||||
guicontrol,, RaceProgress, 0
|
||||
Race_Tokyo()
|
||||
return
|
||||
|
||||
|
||||
MouseHelp:
|
||||
|
||||
coord=relative
|
||||
sleep, 1000
|
||||
CoordMode, ToolTip, %coord%
|
||||
CoordMode, Pixel, %coord%
|
||||
CoordMode, Mouse, %coord%
|
||||
CoordMode, Caret, %coord%
|
||||
CoordMode, Menu, %coord%
|
||||
return
|
||||
|
||||
Refresh:
|
||||
MouseGetPos, x, y
|
||||
PixelGetColor, cBGR, %x%, %y%,, Alt RGB
|
||||
WinGetPos,,, w, h, A
|
||||
ToolTip,Location: %x% x %y%`nRGB: %cBGR%`nWindow Size: %w% x %h%
|
||||
return
|
||||
|
||||
MouseColor:
|
||||
gosub, MouseHelp
|
||||
SetTimer, Refresh, 75
|
||||
return
|
||||
|
||||
GuiClose:
|
||||
gosub, PauseLoop
|
||||
ExitApp
|
||||
^Esc::ExitApp
|
||||
|
||||
GUIReset:
|
||||
if (GetKeyState("LShift", "P") AND GetKeyState("LAlt", "P")){
|
||||
MsgBox, 4,, Reset all data?
|
||||
IfMsgBox Yes
|
||||
{
|
||||
IniWrite, 0, config.ini,Stats, RaceCounterTotal
|
||||
IniWrite, 0, config.ini,Stats, ResetCounterTotal
|
||||
}
|
||||
}
|
||||
Sleep(500)
|
||||
gosub, PauseLoop
|
||||
Reload
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
151
bnowakow/old versions/5 Tokyo/GT7-TOKYO-9.2/Lib/CLR.ahk
Normal file
151
bnowakow/old versions/5 Tokyo/GT7-TOKYO-9.2/Lib/CLR.ahk
Normal 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 : ""
|
||||
}
|
||||
2714
bnowakow/old versions/5 Tokyo/GT7-TOKYO-9.2/Lib/Gdip.ahk
Normal file
2714
bnowakow/old versions/5 Tokyo/GT7-TOKYO-9.2/Lib/Gdip.ahk
Normal file
File diff suppressed because it is too large
Load Diff
BIN
bnowakow/old versions/5 Tokyo/GT7-TOKYO-9.2/Lib/SuperSleep.dll
Normal file
BIN
bnowakow/old versions/5 Tokyo/GT7-TOKYO-9.2/Lib/SuperSleep.dll
Normal file
Binary file not shown.
BIN
bnowakow/old versions/5 Tokyo/GT7-TOKYO-9.2/Lib/ViGEmWrapper.dll
Normal file
BIN
bnowakow/old versions/5 Tokyo/GT7-TOKYO-9.2/Lib/ViGEmWrapper.dll
Normal file
Binary file not shown.
@@ -0,0 +1,188 @@
|
||||
|
||||
/**********************************************
|
||||
* Controller methods for simplicity *
|
||||
***********************************************/
|
||||
*/
|
||||
|
||||
GoTo EndControllerFunctionsDef
|
||||
|
||||
;;;;;;;;;;;; Turning functions
|
||||
;;;;;;;;;;;; For holding the stick in a specific position for a period of time
|
||||
;;;;;;;;;;;; Note no other button may be pressed or released when these functions are ran
|
||||
|
||||
; Set the time you want to turn for in miliseconds and how hard (50, 100), 100 being the most, 50 being neutral
|
||||
Turn_Right(sleept, inten){
|
||||
t := sleept
|
||||
controller.Axes.LX.SetState(inten)
|
||||
gosub, Turn
|
||||
controller.Axes.LX.SetState(50)
|
||||
}
|
||||
|
||||
; Set the time you want to turn for in miliseconds and how hard (0, 50), 0 being the most
|
||||
Turn_Left(sleept, inten){
|
||||
t := sleept
|
||||
controller.Axes.LX.SetState(inten)
|
||||
gosub, Turn
|
||||
controller.Axes.LX.SetState(50)
|
||||
}
|
||||
|
||||
;;;;;;;;;;;; Simple button press functions
|
||||
;;;;;;;;;;;; You can pass a delay amount or leave it blank
|
||||
;;;;;;;;;;;; Longer delays hold the button longer
|
||||
|
||||
; Press X button
|
||||
Press_X(delay:=200){
|
||||
controller.Buttons.Cross.SetState(true)
|
||||
DllCall("Sleep", "UInt", delay)
|
||||
controller.Buttons.Cross.SetState(false)
|
||||
return
|
||||
}
|
||||
|
||||
; Press O button
|
||||
Press_O(delay:=200){
|
||||
controller.Buttons.Circle.SetState(true)
|
||||
DllCall("Sleep", "UInt", delay)
|
||||
controller.Buttons.Circle.SetState(false)
|
||||
return
|
||||
}
|
||||
|
||||
; Press Triangle button
|
||||
Press_Triangle(delay:=200){
|
||||
controller.Buttons.Triangle.SetState(true)
|
||||
DllCall("Sleep", "UInt", delay)
|
||||
controller.Buttons.Triangle.SetState(false)
|
||||
return
|
||||
}
|
||||
|
||||
; Press Square button
|
||||
Press_Square(delay:=200){
|
||||
controller.Buttons.Square.SetState(true)
|
||||
DllCall("Sleep", "UInt", delay)
|
||||
controller.Buttons.Square.SetState(false)
|
||||
return
|
||||
}
|
||||
|
||||
; Press R1 button
|
||||
Press_L1(delay:=200){
|
||||
controller.Buttons.L1.SetState(true)
|
||||
DllCall("Sleep", "UInt", delay)
|
||||
controller.Buttons.L1.SetState(false)
|
||||
return
|
||||
}
|
||||
|
||||
; Press R1 button
|
||||
Press_R1(delay:=200){
|
||||
controller.Buttons.R1.SetState(true)
|
||||
DllCall("Sleep", "UInt", delay)
|
||||
controller.Buttons.R1.SetState(false)
|
||||
return
|
||||
}
|
||||
|
||||
; Press Right on D-pad
|
||||
Press_Right(delay:=200){
|
||||
controller.Dpad.SetState("Right")
|
||||
DllCall("Sleep", "UInt", delay)
|
||||
controller.Dpad.SetState("None")
|
||||
return
|
||||
}
|
||||
|
||||
; Press Left on D-pad
|
||||
Press_Left(delay:=200){
|
||||
controller.Dpad.SetState("Left")
|
||||
DllCall("Sleep", "UInt", delay)
|
||||
controller.Dpad.SetState("None")
|
||||
return
|
||||
}
|
||||
|
||||
; Press Up on D-pad
|
||||
Press_Up(delay:=200){
|
||||
controller.Dpad.SetState("Up")
|
||||
DllCall("Sleep", "UInt", delay)
|
||||
controller.Dpad.SetState("None")
|
||||
return
|
||||
}
|
||||
|
||||
; Press Down on D-pad
|
||||
Press_Down(delay:=200){
|
||||
controller.Dpad.SetState("Down")
|
||||
DllCall("Sleep", "UInt", delay)
|
||||
controller.Dpad.SetState("None")
|
||||
return
|
||||
}
|
||||
|
||||
;;;;;;;;;;; Other functions specific to GT7
|
||||
|
||||
; Turn on nitrous
|
||||
Nitrous_On(){
|
||||
controller.Buttons.RS.SetState(true)
|
||||
}
|
||||
|
||||
; Turn off nitrous
|
||||
Nitrous_Off(){
|
||||
controller.Buttons.RS.SetState(false)
|
||||
}
|
||||
|
||||
Accel_On(control:=100){
|
||||
controller.Buttons.R2.SetState(true)
|
||||
controller.Axes.RT.SetState(control)
|
||||
}
|
||||
|
||||
Accel_Off(){
|
||||
controller.Buttons.R2.SetState(false)
|
||||
controller.Axes.RT.SetState(0)
|
||||
}
|
||||
|
||||
Brake_On(control:=100){
|
||||
controller.Buttons.L2.SetState(true)
|
||||
controller.Axes.LT.SetState(control)
|
||||
}
|
||||
|
||||
Brake_Off(){
|
||||
controller.Buttons.L2.SetState(false)
|
||||
controller.Axes.LT.SetState(0)
|
||||
}
|
||||
; given time t in miliseconds, turn right for that long, with intensity being how much the turn button is held for
|
||||
Turn:
|
||||
t0 := A_TickCount
|
||||
tf := t0+t
|
||||
loop {
|
||||
Sleep(100)
|
||||
} until A_TickCount > tf
|
||||
return
|
||||
|
||||
|
||||
Press_Options(){
|
||||
controller.Buttons.Options.SetState(true)
|
||||
Sleep, 50
|
||||
controller.Buttons.Options.SetState(false)
|
||||
}
|
||||
|
||||
|
||||
PressX:
|
||||
; Just for menuing, does not hold X down
|
||||
controller.Buttons.Cross.SetState(true)
|
||||
DllCall("Sleep", "UInt", 200)
|
||||
controller.Buttons.Cross.SetState(false)
|
||||
return
|
||||
|
||||
PressO:
|
||||
; Just for menuing, does not hold O down
|
||||
controller.Buttons.Circle.SetState(true)
|
||||
DllCall("Sleep", "UInt", 200)
|
||||
controller.Buttons.Circle.SetState(false)
|
||||
return
|
||||
|
||||
PressRight:
|
||||
; For turning
|
||||
controller.Dpad.SetState("Right")
|
||||
Sleep, 50
|
||||
controller.Dpad.SetState("None")
|
||||
return
|
||||
|
||||
PressShare:
|
||||
controller.Buttons.Share.SetState(true)
|
||||
Sleep, 50
|
||||
controller.Buttons.Share.SetState(false)
|
||||
return
|
||||
|
||||
EndControllerFunctionsDef:
|
||||
136
bnowakow/old versions/5 Tokyo/GT7-TOKYO-9.2/Lib/__utility__.ahk
Normal file
136
bnowakow/old versions/5 Tokyo/GT7-TOKYO-9.2/Lib/__utility__.ahk
Normal file
@@ -0,0 +1,136 @@
|
||||
/**********************************************
|
||||
* Only place functions here, no sub routines *
|
||||
***********************************************/
|
||||
|
||||
|
||||
; Grabs the colors of the pixels (x-b, y-b) to (x+b, y+b)
|
||||
; returns the array of colors
|
||||
*/
|
||||
|
||||
BitGrab(x, y, b)
|
||||
{
|
||||
HWND := WinExist("PS Remote Play")
|
||||
pToken := Gdip_Startup()
|
||||
pBitmap := Gdip_BitmapFromHWND2(hwnd)
|
||||
|
||||
pixs := []
|
||||
for i in range(-1*b, b+1){
|
||||
for j in range(-1*b, b+1){
|
||||
pixel := Gdip_GetPixel(pBitmap,x+i,y+j)
|
||||
rgb := ConvertARGB( pixel )
|
||||
pixs.Push(rgb)
|
||||
}
|
||||
}
|
||||
|
||||
Gdip_DisposeImage(pBitmap)
|
||||
Gdip_Shutdown(pToken)
|
||||
return pixs
|
||||
}
|
||||
|
||||
Gdip_BitmapFromHWND2(hwnd)
|
||||
{
|
||||
WinGetPos,,, Width, Height, ahk_id %hwnd%
|
||||
hbm := CreateDIBSection(Width, Height), hdc := CreateCompatibleDC(), obm := SelectObject(hdc, hbm)
|
||||
RegExMatch(A_OsVersion, "\d+", Version)
|
||||
PrintWindow(hwnd, hdc, Version >= 8 ? 2 : 0)
|
||||
pBitmap := Gdip_CreateBitmapFromHBITMAP(hbm)
|
||||
SelectObject(hdc, obm), DeleteObject(hbm), DeleteDC(hdc)
|
||||
return pBitmap
|
||||
}
|
||||
|
||||
range(start, stop:="", step:=1) {
|
||||
static range := { _NewEnum: Func("_RangeNewEnum") }
|
||||
if !step
|
||||
throw "range(): Parameter 'step' must not be 0 or blank"
|
||||
if (stop == "")
|
||||
stop := start, start := 0
|
||||
; Formula: r[i] := start + step*i ; r = range object, i = 0-based index
|
||||
; For a postive 'step', the constraints are i >= 0 and r[i] < stop
|
||||
; For a negative 'step', the constraints are i >= 0 and r[i] > stop
|
||||
; No result is returned if r[0] does not meet the value constraint
|
||||
if (step > 0 ? start < stop : start > stop) ;// start == start + step*0
|
||||
return { base: range, start: start, stop: stop, step: step }
|
||||
}
|
||||
|
||||
_RangeNewEnum(r) {
|
||||
static enum := { "Next": Func("_RangeEnumNext") }
|
||||
return { base: enum, r: r, i: 0 }
|
||||
}
|
||||
|
||||
_RangeEnumNext(enum, ByRef k, ByRef v:="") {
|
||||
stop := enum.r.stop, step := enum.r.step
|
||||
, k := enum.r.start + step*enum.i
|
||||
if (ret := step > 0 ? k < stop : k > stop)
|
||||
enum.i += 1
|
||||
return ret
|
||||
}
|
||||
|
||||
|
||||
Sleep(ms=1)
|
||||
{
|
||||
global timeBeginPeriodHasAlreadyBeenCalled
|
||||
if (timeBeginPeriodHasAlreadyBeenCalled != 1)
|
||||
{
|
||||
DllCall("Winmm.dll\timeBeginPeriod", UInt, 1)
|
||||
timeBeginPeriodHasAlreadyBeenCalled := 1
|
||||
}
|
||||
|
||||
DllCall("Sleep", UInt, ms)
|
||||
}
|
||||
|
||||
|
||||
|
||||
PixelColorSimple(pc_x, pc_y)
|
||||
{
|
||||
WinGet, remotePlay_id, List, ahk_exe RemotePlay.exe
|
||||
if (remotePlay_id = 0)
|
||||
{
|
||||
MsgBox, PS4 Remote Play not found
|
||||
return
|
||||
}
|
||||
if remotePlay_id
|
||||
{
|
||||
pc_wID := remotePlay_id[0]
|
||||
pc_hDC := DllCall("GetDC", "UInt", pc_wID)
|
||||
pc_fmtI := A_FormatInteger
|
||||
SetFormat, IntegerFast, Hex
|
||||
pc_c := DllCall("GetPixel", "UInt", pc_hDC, "Int", pc_x, "Int", pc_y, "UInt")
|
||||
pc_c := pc_c >> 16 & 0xff | pc_c & 0xff00 | (pc_c & 0xff) << 16
|
||||
pc_c .= ""
|
||||
SetFormat, IntegerFast, %pc_fmtI%
|
||||
DllCall("ReleaseDC", "UInt", pc_wID, "UInt", pc_hDC)
|
||||
return pc_c
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
GetClientSize(hWnd, ByRef w := "", ByRef h := "")
|
||||
{
|
||||
VarSetCapacity(rect, 16)
|
||||
DllCall("GetClientRect", "ptr", hWnd, "ptr", &rect)
|
||||
w := NumGet(rect, 8, "int")
|
||||
h := NumGet(rect, 12, "int")
|
||||
}
|
||||
|
||||
Distance(c1, c2)
|
||||
{ ; function by [VxE], return value range = [0, 441.67295593006372]
|
||||
return Sqrt((((c1>>16)-(c2>>16))**2)+(((c1>>8&255)-(c2>>8&255))**2)+(((c1&255)-(c1&255))**2))
|
||||
}
|
||||
|
||||
ConvertARGB(ARGB, Convert := 0)
|
||||
{
|
||||
SetFormat, IntegerFast, Hex
|
||||
RGB += ARGB
|
||||
RGB := RGB & 0x00FFFFFF
|
||||
if (Convert)
|
||||
RGB := (RGB & 0xFF000000) | ((RGB & 0xFF0000) >> 16) | (RGB & 0x00FF00) | ((RGB & 0x0000FF) << 16)
|
||||
|
||||
return RGB
|
||||
}
|
||||
|
||||
ToolTipper(msg, x := 100, y := 100)
|
||||
{
|
||||
if (debug_mode = 1)
|
||||
ToolTip, %msg%, x, y, Screen
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,367 @@
|
||||
__enableTokyoDetections_mod__ := 1
|
||||
IniRead, color_pitstop1, config.ini, Vars, color_pitstop1, 0
|
||||
IniRead, color_pitstop2, config.ini, Vars, color_pitstop2, 0
|
||||
|
||||
class TokyoTurnContainer
|
||||
{
|
||||
__New(startX, startY, endX := 0, endY := 0)
|
||||
{
|
||||
this.startX := startX
|
||||
this.startY := startY
|
||||
this.endX := endX
|
||||
this.endY := endY
|
||||
}
|
||||
}
|
||||
|
||||
GoTo EndTokyoDetectionsDef
|
||||
|
||||
CheckTokyoMFD(x,y, b_size := 1)
|
||||
{
|
||||
color_dot := 0xD3D2D0
|
||||
TokyoMFD := false
|
||||
tries := 1000 ; we shouldn't need more than 6 tries, but I have seen it loop passed
|
||||
loop {
|
||||
|
||||
tc := BitGrab(x, y, b_size)
|
||||
SB_SetText(" Searching... " td " < 5",2)
|
||||
for i, c in tc
|
||||
{
|
||||
td := Distance(c, color_dot)
|
||||
|
||||
if (td < 5){
|
||||
SB_SetText(" Found: " td " < 5",2)
|
||||
TokyoMFD := true
|
||||
break
|
||||
}
|
||||
else {
|
||||
; Gonna try to automate the mfd checker, why not right?
|
||||
if (tries > 0){
|
||||
SB_SetText(" Searching Track/Course Map MFD " td " < 5",2)
|
||||
Press_Left()
|
||||
Sleep(200)
|
||||
tries--
|
||||
break
|
||||
}
|
||||
tries := 1000
|
||||
TokyoMFD := true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
} until TokyoMFD = true
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
CheckTokyoTurn(x,y, b_size := 1)
|
||||
{
|
||||
turnStart := A_TickCount
|
||||
color_player := 0xDE6E70
|
||||
TokyoTurnComplete := false
|
||||
loop {
|
||||
SB_SetText(" Searching... " td " < 50",2)
|
||||
tc := BitGrab(x, y, b_size)
|
||||
for i, c in tc
|
||||
{
|
||||
td := Distance(c, color_player)
|
||||
|
||||
if (td < 50 ){
|
||||
SB_SetText(" Found: " td " < 50",2)
|
||||
TokyoTurnComplete := true
|
||||
break
|
||||
}
|
||||
}
|
||||
; add recovery so we don't kill run looking for turn. Gonna start with a high number, can adjust lower later.
|
||||
; added some press down, x's and waits just in case we are in the pit stop
|
||||
if (A_TickCount - turnStart > 90000) {
|
||||
Press_Down()
|
||||
Sleep(300)
|
||||
Press_X()
|
||||
Sleep(500)
|
||||
Press_X()
|
||||
Sleep(7000)
|
||||
GoSub, ResetRace
|
||||
break
|
||||
}
|
||||
|
||||
} until TokyoTurnComplete = true
|
||||
return
|
||||
}
|
||||
|
||||
CheckTokyoPen1(x,y, b_size := 1)
|
||||
{
|
||||
pen1Start := A_TickCount
|
||||
|
||||
color_pen := 0xFFC10B
|
||||
TokyoPen1 := false
|
||||
loop {
|
||||
SB_SetText(" Searching... " td " < 50",2)
|
||||
tc := BitGrab(x, y, b_size)
|
||||
for i, c in tc
|
||||
{
|
||||
td := Distance(c, color_pen)
|
||||
|
||||
if (td < 50 ){
|
||||
SB_SetText(" Found: " td " < 50",2)
|
||||
TokyoPen1 := true
|
||||
break
|
||||
}
|
||||
}
|
||||
; add recovery so we don't kill run looking for Pen1. Gonna start with a high number, can adjust lower later.
|
||||
; started with 1.5 mins, i had these set to 3:33 on other file and still won.
|
||||
if (A_TickCount - pen1Start > 90000) {
|
||||
GoSub, ResetRace
|
||||
break
|
||||
}
|
||||
|
||||
} until TokyoPen1 = true
|
||||
return
|
||||
}
|
||||
|
||||
CheckTokyoHairpinTurn(x,y, b_size := 1)
|
||||
{
|
||||
hairpinStart := A_TickCount
|
||||
|
||||
color_hairpinturn := 0xB3B1B2
|
||||
TokyoHairpinTurn := false
|
||||
loop {
|
||||
SB_SetText(" Searching... " td " < 5",2)
|
||||
tc := BitGrab(x, y, b_size)
|
||||
for i, c in tc
|
||||
{
|
||||
td := Distance(c, color_hairpinturn)
|
||||
|
||||
if (td < 5){
|
||||
SB_SetText(" Found: " td " < 5",2)
|
||||
TokyoHairpinTurn := true
|
||||
break
|
||||
}
|
||||
}
|
||||
; add recovery so we don't kill run sitting in hairpin
|
||||
; set to 1 minute to start, I had this at 3:33 (200000) on my other file and still won.
|
||||
if (A_TickCount - hairpinStart > 90000) {
|
||||
|
||||
GoSub, ResetRace
|
||||
break
|
||||
}
|
||||
|
||||
} until TokyoHairpinTurn = true
|
||||
return
|
||||
}
|
||||
|
||||
CheckTokyoPen2(x,y, b_size := 1)
|
||||
{
|
||||
start := A_TickCount
|
||||
color_pen := 0xFFC10B
|
||||
RecoveryTried := false
|
||||
TokyoPen2 := false
|
||||
|
||||
loop {
|
||||
SB_SetText(" Searching... " td " > 60",2)
|
||||
tc := BitGrab(x, y, b_size)
|
||||
for i, c in tc
|
||||
{
|
||||
td := Distance(c, color_pen)
|
||||
|
||||
if (td > 60 ){
|
||||
SB_SetText(" Found: " td " > 60",2)
|
||||
TokyoPen2 := true
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
if (A_TickCount - start > 25000 AND RecoveryTried = false) {
|
||||
SB_SetText(" We stuck? Starting recovery try.",2)
|
||||
Accel_off()
|
||||
controller.Axes.LX.SetState(50)
|
||||
loop 7 {
|
||||
Press_Square(delay:=50)
|
||||
Sleep(100)
|
||||
}
|
||||
Accel_on(80)
|
||||
Sleep(500)
|
||||
loop 9 {
|
||||
Press_Triangle(delay:=50)
|
||||
Sleep(100)
|
||||
}
|
||||
controller.Axes.LX.SetState(30)
|
||||
RecoveryTried := true
|
||||
}
|
||||
|
||||
if (A_TickCount - start > 60000) {
|
||||
gosub, ResetRace
|
||||
break
|
||||
}
|
||||
|
||||
} until TokyoPen2 = true
|
||||
return
|
||||
}
|
||||
|
||||
CheckTokyoPenServed(x,y, b_size := 1)
|
||||
{
|
||||
color_penserved := 0xAE1B1E
|
||||
TokyoPenServed := false
|
||||
loop {
|
||||
SB_SetText(" Searching... " td " > 60",2)
|
||||
tc := BitGrab(x, y, b_size)
|
||||
for i, c in tc
|
||||
{
|
||||
td := Distance(c, color_penserved)
|
||||
|
||||
if (td > 60 ){
|
||||
SB_SetText(" Found: " td " > 60",2)
|
||||
TokyoPenServed := true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
} until TokyoPenServed = true
|
||||
return
|
||||
}
|
||||
|
||||
CheckTokyoPenReceived(x,y, b_size := 1)
|
||||
{
|
||||
start := A_TickCount
|
||||
color_penreceived := 0xAE1B1E
|
||||
TokyoPenReceived := false
|
||||
loop {
|
||||
SB_SetText(" Searching... " td " < 40",2)
|
||||
tc := BitGrab(x, y, b_size)
|
||||
for i, c in tc
|
||||
{
|
||||
td := Distance(c, color_penreceived)
|
||||
|
||||
if (td < 40 ){
|
||||
SB_SetText(" Found: " td " < 40",2)
|
||||
guicontrol,, CurrentLoop, Pen received
|
||||
TokyoPenReceived := true
|
||||
break
|
||||
}
|
||||
if (TokyoLapCount != 6 AND A_TickCount - start > 36000)
|
||||
{
|
||||
SB_SetText(" Not found in time. Shifting up.",2)
|
||||
loop 6 {
|
||||
Press_Triangle(delay:=50)
|
||||
Sleep(200)
|
||||
TokyoPenReceived := true
|
||||
break
|
||||
}
|
||||
break
|
||||
}
|
||||
if (TokyoLapCount = 6 AND A_TickCount - start > 46000)
|
||||
{
|
||||
SB_SetText(" Not found in time. Shifting up.",2)
|
||||
loop 20 {
|
||||
Press_Triangle(delay:=50)
|
||||
Sleep(200)
|
||||
TokyoPenReceived := true
|
||||
break
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
} until TokyoPenReceived = true
|
||||
return
|
||||
}
|
||||
|
||||
CheckTokyoPitstopDone(x,y, b_size := 1)
|
||||
{
|
||||
pitstopDoneStart := A_TickCount
|
||||
|
||||
color_pitstopdone := 0xFFFFFF
|
||||
TokyoPitstopDone := false
|
||||
loop {
|
||||
SB_SetText(" Searching... " td " > 10",2)
|
||||
tc := BitGrab(x, y, b_size)
|
||||
for i, c in tc
|
||||
{
|
||||
td := Distance(c, color_pitstopdone)
|
||||
|
||||
if (td > 10 ){
|
||||
SB_SetText(" Found: " td " > 10",2)
|
||||
TokyoPitstopDone := true
|
||||
break
|
||||
}
|
||||
}
|
||||
; add recovery so we don't kill run sitting in pit, havent tested if press down works to get us out
|
||||
if (A_TickCount - pitstopDoneStart > 60000) {
|
||||
Press_Down()
|
||||
Sleep(300)
|
||||
Press_X()
|
||||
Sleep(500)
|
||||
Press_X()
|
||||
Sleep(7000)
|
||||
GoSub, ResetRace
|
||||
}
|
||||
} until TokyoPitstopDone = true
|
||||
return
|
||||
}
|
||||
|
||||
CheckMaxTime(maxTime, loopStartTime, TokyoLapCount)
|
||||
{
|
||||
if ( A_TickCount - loopStartTime > maxTime AND TokyoLapCount <= 10) {
|
||||
gosub, ResetRace
|
||||
}
|
||||
else if (A_TickCount - loopStartTime > maxTime+90000 AND TokyoLapCount > 10)
|
||||
{
|
||||
gosub, ResetRace
|
||||
}
|
||||
}
|
||||
|
||||
CheckTokyoPitstop1(x,y, b_size := 1)
|
||||
{
|
||||
pitstop1Start := A_TickCount
|
||||
|
||||
;color_pitstop1 := 0xFFFFFF
|
||||
;color_pitstop1 := 0x818002
|
||||
;color_pitstop1 := 0xFBFB00 ; old color
|
||||
TokyoPitstop := false
|
||||
loop {
|
||||
SB_SetText(" Searching... " td " < 10",2)
|
||||
tc := BitGrab(x, y, b_size)
|
||||
for i, c in tc
|
||||
{
|
||||
td := Distance(c, color_pitstop1)
|
||||
|
||||
if (td < 10 ){
|
||||
SB_SetText(" Found: " td " < 10",2)
|
||||
TokyoPitstop := true
|
||||
break
|
||||
}
|
||||
}
|
||||
; add recovery so we don't kill run sitting in pit, havent tested if press down works to get us out
|
||||
if (A_TickCount - pitstop1Start > 60000) {
|
||||
Press_Down()
|
||||
Sleep(300)
|
||||
Press_X()
|
||||
Sleep(500)
|
||||
Press_X()
|
||||
Sleep(7000)
|
||||
GoSub, ResetRace
|
||||
}
|
||||
guicontrol,, CurrentLoop, Stuck in pit? Press GUI Button.
|
||||
|
||||
} until TokyoPitstop = true
|
||||
return
|
||||
}
|
||||
UpdateAVG(racecounter, script_start)
|
||||
{
|
||||
SetFormat, integerfast, d
|
||||
creditcountersession := (835000*racecounter)/1000000
|
||||
SetFormat, integerfast, d
|
||||
SetFormat, FloatFast, 0.2
|
||||
creditavg := creditcountersession/(A_TickCount-script_start)*3600000
|
||||
guicontrol,, CreditAVG, Avg./h: ~%creditavg% M
|
||||
return
|
||||
}
|
||||
|
||||
UpdateTimer()
|
||||
{
|
||||
ElapsedTime := A_TickCount - script_start
|
||||
VarSetCapacity(t,256),DllCall("GetDurationFormat","uint",2048,"uint",0,"ptr",0,"int64",ElapsedTime*10000,"wstr","d' day(s) 'h':'mm':'ss","wstr",t,"int",256)
|
||||
SB_SetText("Runtime: " t,3)
|
||||
return
|
||||
}
|
||||
|
||||
EndTokyoDetectionsDef:
|
||||
86
bnowakow/old versions/5 Tokyo/GT7-TOKYO-9.2/Race.ahk
Normal file
86
bnowakow/old versions/5 Tokyo/GT7-TOKYO-9.2/Race.ahk
Normal file
@@ -0,0 +1,86 @@
|
||||
#Include Races\PanAm.ahk
|
||||
#Include Races\Tokyo.ahk
|
||||
|
||||
GoTo EndRaceDef
|
||||
|
||||
Race:
|
||||
|
||||
Switch RaceChoice
|
||||
{
|
||||
case "PanAm":
|
||||
Race_PANAM()
|
||||
return
|
||||
case "Tokyo":
|
||||
Race_Tokyo()
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
|
||||
SettingsSheet:
|
||||
|
||||
Gui, 4: Show, AutoSize, Settings Sheet
|
||||
;/////////////////////////////////////////////////////////
|
||||
; Add images to your setup here and in the Src folder
|
||||
;
|
||||
;/////////////////////////////////////////////////////////
|
||||
Switch RaceChoice
|
||||
{
|
||||
case "PanAm":
|
||||
|
||||
assist_1 = %A_ScriptDir%\Src\PanAm\Assist1.jpg
|
||||
assist_2 = %A_ScriptDir%\Src\PanAm\Assist2.jpg
|
||||
tune_1 = %A_ScriptDir%\Src\PanAm\CarSetup.jpg
|
||||
tune_2 = %A_ScriptDir%\Src\PanAm\CarGearRatio.jpg
|
||||
controls = %A_ScriptDir%\Src\PanAm\Controller.jpg
|
||||
return
|
||||
case "Tokyo":
|
||||
|
||||
assist_1 = %A_ScriptDir%\Src\Tokyo\Assist_Settings.png
|
||||
assist_2 = %A_ScriptDir%\Src\Tokyo\Misc_Settings.png
|
||||
controls = %A_ScriptDir%\Src\Tokyo\Controller_Settings.png
|
||||
tune_1 = %A_ScriptDir%\Src\Tokyo\Settings_Car1.png
|
||||
tune_2 = %A_ScriptDir%\Src\Tokyo\Settings_Car2.png
|
||||
tune_3 = %A_ScriptDir%\Src\Tokyo\Settings_Car3.png
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
return
|
||||
|
||||
Assists1:
|
||||
GuiControl, 4:, CurrentPic, %assist_1%
|
||||
gosub, Guisizer
|
||||
return
|
||||
|
||||
Assists2:
|
||||
GuiControl, 4:, CurrentPic, %assist_2%
|
||||
gosub, Guisizer
|
||||
return
|
||||
|
||||
Tune1:
|
||||
GuiControl, 4:, CurrentPic, %tune_1%
|
||||
gosub, Guisizer
|
||||
return
|
||||
|
||||
Tune2:
|
||||
GuiControl, 4:, CurrentPic, %tune_2%
|
||||
gosub, Guisizer
|
||||
return
|
||||
|
||||
Tune3:
|
||||
GuiControl, 4:, CurrentPic, %tune_2%
|
||||
gosub, Guisizer
|
||||
return
|
||||
|
||||
ControllerSetting:
|
||||
GuiControl, 4:, CurrentPic, %controls%
|
||||
gosub, Guisizer
|
||||
return
|
||||
|
||||
Guisizer:
|
||||
GuiControl, 4: Move, CurrentPic, % "x" 10 "y" 40 "w" 1200 . " h" . 800
|
||||
Gui, 4: Show, AutoSize, Settings Sheet
|
||||
return
|
||||
|
||||
EndRaceDef:
|
||||
494
bnowakow/old versions/5 Tokyo/GT7-TOKYO-9.2/Races/Tokyo.ahk
Normal file
494
bnowakow/old versions/5 Tokyo/GT7-TOKYO-9.2/Races/Tokyo.ahk
Normal file
@@ -0,0 +1,494 @@
|
||||
GoTo EndRace_Tokyo_Def
|
||||
|
||||
Race_Tokyo()
|
||||
{
|
||||
SetFormat, integerfast, d
|
||||
TokyoStart:
|
||||
;- VARIABLES -----------------------------------------------------------------------------
|
||||
SetFormat, integerfast, d
|
||||
TokyoLapCount := 1
|
||||
maxTime := 200000
|
||||
;- COORDINATES: TURNS --------------------------------------------------------------------
|
||||
TokyoTurn1 := new TokyoTurnContainer(611, 59+remote_play_offsetY, 622, 69+remote_play_offsetY)
|
||||
TokyoTurn2 := new TokyoTurnContainer(618, 70+remote_play_offsetY, 601, 76+remote_play_offsetY)
|
||||
TokyoTurn3 := new TokyoTurnContainer(599, 79+remote_play_offsetY, 591, 87+remote_play_offsetY)
|
||||
TokyoTurn4 := new TokyoTurnContainer(589, 88+remote_play_offsetY, 571, 96+remote_play_offsetY)
|
||||
TokyoTurn5 := new TokyoTurnContainer(567, 96+remote_play_offsetY, 556, 90+remote_play_offsetY)
|
||||
TokyoTurn6 := new TokyoTurnContainer(554, 86+remote_play_offsetY, 543, 82+remote_play_offsetY)
|
||||
TokyoTurn7 := new TokyoTurnContainer(538, 81+remote_play_offsetY, 530, 75+remote_play_offsetY)
|
||||
TokyoTurn8 := new TokyoTurnContainer(530, 75+remote_play_offsetY, 510, 72+remote_play_offsetY)
|
||||
;- COORDINATES: PENALTY WARNINGS ---------------------------------------------------------
|
||||
TokyoPenWarning := new TokyoTurnContainer(360, 154+remote_play_offsetY, 408, 154+remote_play_offsetY)
|
||||
TokyoPenIndicator := new TokyoTurnContainer(366, 132+remote_play_offsetY)
|
||||
;- COORDINATES: HAIRPIN TURN -------------------------------------------------------------
|
||||
TokyoHairpinTurn := new TokyoTurnContainer(606, 334+remote_play_offsetY)
|
||||
;- COORDINATES: PENALTY WARNINGS ---------------------------------------------------------
|
||||
TokyoPen := new TokyoTurnContainer(360, 154+remote_play_offsetY, 408, 154+remote_play_offsetY)
|
||||
TokyoPenServed := new TokyoTurnContainer(366, 132+remote_play_offsetY)
|
||||
;- COORDINATES: HAIRPIN TURN--------------------------------------------------------------
|
||||
TokyoHairpinTurn := new TokyoTurnContainer(606, 334+remote_play_offsetY)
|
||||
;- MISC ----------------------------------------------------------------------------------
|
||||
TokyoPitstop := new TokyoTurnContainer(191, 316+remote_play_offsetY, 580, 383+remote_play_offsetY)
|
||||
TokyoPitstopEnter := new TokyoTurnContainer(530, 70+remote_play_offsetY)
|
||||
TokyoPitstopDone := new TokyoTurnContainer(57, 329+remote_play_offsetY)
|
||||
TokyoRestartRace := new TokyoTurnContainer(405,465+remote_play_offsetY)
|
||||
;- RACE START ----------------------------------------------------------------------------
|
||||
controller.Axes.LX.SetState(65)
|
||||
Sleep(7400)
|
||||
|
||||
FormatTime, TGTime,, MM/dd hh:mm:ss
|
||||
FileAppend, %TGTime%: Race started.`n, logs.txt
|
||||
url := "https://api.telegram.org/bot" TelegramBotToken "/sendMessage?text=" TGTime ": Race started.&chat_id=" TelegramChatID
|
||||
hObject:=ComObjCreate("WinHttp.WinHttpRequest.5.1")
|
||||
hObject.Open("GET",url)
|
||||
hObject.Send()
|
||||
|
||||
guicontrol,, CurrentLoop, Race started. Good luck!
|
||||
guicontrol,, CurrentLap, Current Lap: %TokyoLapCount% /12
|
||||
Accel_On(100)
|
||||
loop 3 {
|
||||
Press_Triangle(delay:=50)
|
||||
Sleep(200)
|
||||
}
|
||||
Sleep(800)
|
||||
controller.Axes.LX.SetState(65)
|
||||
;- 12 LAP LOOP ---------------------------------------------------------------------------
|
||||
loop 12
|
||||
{
|
||||
location := "Start/Finish"
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
loopStartTime := A_TickCount
|
||||
; Turn 1
|
||||
location := "T1 Start"
|
||||
CheckMaxTime(maxTime, loopStartTime, TokyoLapCount)
|
||||
CheckTokyoTurn(TokyoTurn1.startX, TokyoTurn1.startY)
|
||||
loop 3 {
|
||||
Press_Triangle(delay:=50)
|
||||
Sleep(200)
|
||||
}
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
controller.Axes.LX.SetState(36)
|
||||
CheckMaxTime(maxTime, loopStartTime, TokyoLapCount)
|
||||
Sleep(1000)
|
||||
location := "T1 End"
|
||||
CheckTokyoTurn(TokyoTurn1.endX, TokyoTurn1.endY)
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
controller.Axes.LX.SetState(35)
|
||||
Sleep(1000)
|
||||
; Turn 2
|
||||
location := "T2 Start"
|
||||
CheckMaxTime(maxTime, loopStartTime, TokyoLapCount)
|
||||
CheckTokyoTurn(TokyoTurn2.startX, TokyoTurn2.startY)
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
controller.Axes.LX.SetState(52)
|
||||
CheckMaxTime(maxTime, loopStartTime, TokyoLapCount)
|
||||
Sleep(1000)
|
||||
location := "T2 End"
|
||||
CheckTokyoTurn(TokyoTurn2.endX, TokyoTurn2.endY)
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
controller.Axes.LX.SetState(40)
|
||||
Sleep(1000)
|
||||
; Turn 3
|
||||
location := "T3 Start"
|
||||
CheckMaxTime(maxTime, loopStartTime, TokyoLapCount)
|
||||
CheckTokyoTurn(TokyoTurn3.startX, TokyoTurn3.startY)
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
Sleep(1000)
|
||||
controller.Axes.LX.SetState(40)
|
||||
CheckMaxTime(maxTime, loopStartTime, TokyoLapCount)
|
||||
CheckTokyoTurn(TokyoTurn3.endX, TokyoTurn3.endY)
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
controller.Axes.LX.SetState(70)
|
||||
Sleep(1000)
|
||||
; Turn 4
|
||||
location := "T4 Start"
|
||||
Accel_On(85)
|
||||
CheckMaxTime(maxTime, loopStartTime, TokyoLapCount)
|
||||
CheckTokyoTurn(TokyoTurn4.startX, TokyoTurn4.startY)
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
Sleep(1000)
|
||||
controller.Axes.LX.SetState(68)
|
||||
CheckMaxTime(maxTime, loopStartTime, TokyoLapCount)
|
||||
CheckTokyoTurn(TokyoTurn4.endX, TokyoTurn4.endY)
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
controller.Axes.LX.SetState(60)
|
||||
Accel_On(70)
|
||||
Sleep(1000)
|
||||
; Turn 5
|
||||
location := "T5 Start"
|
||||
CheckMaxTime(maxTime, loopStartTime, TokyoLapCount)
|
||||
CheckTokyoTurn(TokyoTurn5.startX, TokyoTurn5.startY)
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
controller.Axes.LX.SetState(42)
|
||||
Sleep(1000)
|
||||
CheckMaxTime(maxTime, loopStartTime, TokyoLapCount)
|
||||
CheckTokyoTurn(TokyoTurn5.endX, TokyoTurn5.endY)
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
controller.Axes.LX.SetState(63)
|
||||
Sleep(1000)
|
||||
; Turn 6
|
||||
location := "T6 Start"
|
||||
CheckMaxTime(maxTime, loopStartTime, TokyoLapCount)
|
||||
CheckTokyoTurn(TokyoTurn6.startX, TokyoTurn6.startY)
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
controller.Axes.LX.SetState(70)
|
||||
Sleep(1000)
|
||||
Accel_on(75)
|
||||
CheckMaxTime(maxTime, loopStartTime, TokyoLapCount)
|
||||
CheckTokyoTurn(TokyoTurn6.endX, TokyoTurn6.endY)
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
controller.Axes.LX.SetState(40)
|
||||
Sleep(1000)
|
||||
; Turn 7
|
||||
location := "T7 Start"
|
||||
Accel_On(100)
|
||||
CheckMaxTime(maxTime, loopStartTime, TokyoLapCount)
|
||||
CheckTokyoTurn(TokyoTurn7.startX, TokyoTurn7.startY)
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
controller.Axes.LX.SetState(40)
|
||||
Sleep(1000)
|
||||
CheckMaxTime(maxTime, loopStartTime, TokyoLapCount)
|
||||
CheckTokyoTurn(TokyoTurn7.endX, TokyoTurn7.endY)
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
controller.Axes.LX.SetState(70)
|
||||
Sleep(1000)
|
||||
; Turn 8
|
||||
location := "T8 Start"
|
||||
CheckMaxTime(maxTime, loopStartTime, TokyoLapCount)
|
||||
CheckTokyoTurn(TokyoTurn8.startX, TokyoTurn8.startY)
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
controller.Axes.LX.SetState(65)
|
||||
Sleep(1000)
|
||||
CheckMaxTime(maxTime, loopStartTime, TokyoLapCount)
|
||||
CheckTokyoTurn(TokyoTurn8.endX, TokyoTurn8.endY)
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
controller.Axes.LX.SetState(30)
|
||||
Sleep(2000)
|
||||
Brake_on(100)
|
||||
Sleep(2200)
|
||||
Brake_off()
|
||||
Accel_On(35)
|
||||
; Penalty Warning 1
|
||||
location := "Hairpin Entrance"
|
||||
CheckMaxTime(maxTime, loopStartTime, TokyoLapCount)
|
||||
CheckTokyoPen1(TokyoPenWarning.startX, TokyoPenWarning.startY)
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
Accel_On(32)
|
||||
controller.Axes.LX.SetState(40)
|
||||
Sleep(1000)
|
||||
; Hairpin Turn
|
||||
CheckMaxTime(maxTime, loopStartTime, TokyoLapCount)
|
||||
location := "Hairpin Turn"
|
||||
CheckTokyoHairpinTurn(TokyoHairpinTurn.startX, TokyoHairpinTurn.startY)
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
Sleep(hairpin_delay)
|
||||
controller.Axes.LX.SetState(100)
|
||||
Sleep(200)
|
||||
Accel_Off()
|
||||
Sleep(4200)
|
||||
Accel_On(45) ;was 40
|
||||
controller.Axes.LX.SetState(60)
|
||||
Accel_Off()
|
||||
Sleep(800)
|
||||
controller.Axes.LX.SetState(40)
|
||||
Accel_On(50)
|
||||
Sleep(5000)
|
||||
controller.Axes.LX.SetState(30)
|
||||
Sleep(5500)
|
||||
Accel_On(80)
|
||||
loop 30 { ; failsafe, if we ever get a reset caused by a cone under the car
|
||||
Press_Triangle(delay:=100)
|
||||
Sleep(200)
|
||||
}
|
||||
; Penalty Warning 2
|
||||
location := "Hairpin exit"
|
||||
CheckMaxTime(maxTime, loopStartTime, TokyoLapCount)
|
||||
CheckTokyoPen2(TokyoPen.endX, TokyoPen.endY)
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
Sleep(1000)
|
||||
if (TokyoLapCount <= 11)
|
||||
{
|
||||
|
||||
location := "Pit entrance"
|
||||
Accel_On(53)
|
||||
controller.Axes.LX.SetState(30)
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
CheckMaxTime(maxTime, loopStartTime, TokyoLapCount)
|
||||
CheckTokyoTurn(TokyoPitstopEnter.startX, TokyoPitstopEnter.startY)
|
||||
controller.Axes.LX.SetState(0)
|
||||
Accel_On(55)
|
||||
CheckMaxTime(maxTime, loopStartTime, TokyoLapCount)
|
||||
CheckTokyoPitstop1(TokyoPitstop.startX, TokyoPitstop.startY)
|
||||
location := "In pit"
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
controller.Axes.LX.SetState(50)
|
||||
|
||||
if (TokyoLapCount = 1)
|
||||
{
|
||||
SetFormat, integerfast, d
|
||||
lap01timing := 0
|
||||
location := "In pit: Waiting " lap01timing " Seconds."
|
||||
guicontrol,, CurrentLoop, %location%
|
||||
Sleep (lap01timing)
|
||||
Press_Up()
|
||||
Sleep (100)
|
||||
Press_X()
|
||||
Sleep (100)
|
||||
Press_X()
|
||||
}
|
||||
if (TokyoLapCount = 2)
|
||||
{
|
||||
SetFormat, integerfast, d
|
||||
lap02timing := 0
|
||||
location := "In pit: Waiting " lap02timing " Seconds."
|
||||
guicontrol,, CurrentLoop, %location%
|
||||
Sleep (lap02timing)
|
||||
Press_Up()
|
||||
Sleep (100)
|
||||
Press_X()
|
||||
Sleep (100)
|
||||
Press_X()
|
||||
}
|
||||
if (TokyoLapCount = 3)
|
||||
{
|
||||
SetFormat, integerfast, d
|
||||
lap03timing := 0
|
||||
location := "In pit: Waiting " lap03timing " Seconds."
|
||||
guicontrol,, CurrentLoop, %location%
|
||||
Sleep (lap03timing)
|
||||
Press_Up()
|
||||
Sleep (100)
|
||||
Press_X()
|
||||
Sleep (100)
|
||||
Press_X()
|
||||
}
|
||||
if (TokyoLapCount = 4)
|
||||
{
|
||||
SetFormat, integerfast, d
|
||||
lap04timing := 0
|
||||
location := "In pit: Waiting " lap04timing " Seconds."
|
||||
guicontrol,, CurrentLoop, %location%
|
||||
Sleep (lap04timing)
|
||||
Press_Up()
|
||||
Sleep (100)
|
||||
Press_X()
|
||||
Sleep (100)
|
||||
Press_X()
|
||||
}
|
||||
if (TokyoLapCount = 5)
|
||||
{
|
||||
SetFormat, integerfast, d
|
||||
lap05timing := 20000
|
||||
location := "In pit: Waiting " lap05timing " Seconds."
|
||||
guicontrol,, CurrentLoop, %location%
|
||||
Sleep (lap05timing)
|
||||
Press_Up()
|
||||
Sleep (100)
|
||||
Press_X()
|
||||
Sleep (100)
|
||||
Press_X()
|
||||
}
|
||||
if (TokyoLapCount = 6)
|
||||
{
|
||||
SetFormat, integerfast, d
|
||||
lap06timing := 0
|
||||
location := "In pit: Waiting " lap06timing " Seconds."
|
||||
guicontrol,, CurrentLoop, %location%
|
||||
Sleep (lap06timing)
|
||||
Press_Up()
|
||||
Sleep (100)
|
||||
Press_X()
|
||||
}
|
||||
if (TokyoLapCount = 7)
|
||||
{
|
||||
SetFormat, integerfast, d
|
||||
lap07timing := 0
|
||||
location := "In pit: Waiting " lap07timing " Seconds."
|
||||
guicontrol,, CurrentLoop, %location%
|
||||
Sleep (lap07timing)
|
||||
Press_Up()
|
||||
Sleep (100)
|
||||
Press_X()
|
||||
Sleep (100)
|
||||
Press_X()
|
||||
}
|
||||
if (TokyoLapCount = 8)
|
||||
{
|
||||
SetFormat, integerfast, d
|
||||
lap08timing := 0
|
||||
location := "In pit: Waiting " lap08timing " Seconds."
|
||||
guicontrol,, CurrentLoop, %location%
|
||||
Sleep (lap08timing)
|
||||
Press_Up()
|
||||
Sleep (100)
|
||||
Press_X()
|
||||
Sleep (100)
|
||||
Press_X()
|
||||
}
|
||||
if (TokyoLapCount = 9)
|
||||
{
|
||||
SetFormat, integerfast, d
|
||||
lap09timing := 12000
|
||||
location := "In pit: Waiting " lap09timing " Seconds."
|
||||
guicontrol,, CurrentLoop, %location%
|
||||
Sleep (lap09timing)
|
||||
Press_Up()
|
||||
Sleep (100)
|
||||
Press_X()
|
||||
Sleep (100)
|
||||
Press_X()
|
||||
}
|
||||
if (TokyoLapCount = 10)
|
||||
{
|
||||
SetFormat, integerfast, d
|
||||
lap10timing := 20000
|
||||
location := "In pit: Waiting " lap10timing " Seconds."
|
||||
guicontrol,, CurrentLoop, %location%
|
||||
Sleep (lap10timing)
|
||||
Press_Up()
|
||||
Sleep (100)
|
||||
Press_X()
|
||||
Sleep (100)
|
||||
Press_X()
|
||||
}
|
||||
if (TokyoLapCount = 11)
|
||||
{
|
||||
SetFormat, integerfast, d
|
||||
lap11timing := 0
|
||||
location := "In pit: Waiting " lap11timing " Seconds."
|
||||
guicontrol,, CurrentLoop, %location%
|
||||
Sleep (lap11timing)
|
||||
Press_Up()
|
||||
Sleep (100)
|
||||
Press_X()
|
||||
Sleep (100)
|
||||
Press_X()
|
||||
}
|
||||
if (TokyoLapCount = 12)
|
||||
{
|
||||
SetFormat, integerfast, d
|
||||
lap12timing := 0
|
||||
location := "In pit: Waiting " lap12timing " Seconds."
|
||||
guicontrol,, CurrentLoop, %location%
|
||||
Sleep (lap12timing)
|
||||
Press_Up()
|
||||
Sleep (100)
|
||||
Press_X()
|
||||
Sleep (100)
|
||||
Press_X()
|
||||
}
|
||||
controller.Axes.LX.SetState(20)
|
||||
Accel_On(100)
|
||||
CheckMaxTime(maxTime, loopStartTime, TokyoLapCount)
|
||||
CheckTokyoPenReceived(TokyoPenServed.startX, TokyoPenServed.startY)
|
||||
location := "Start/Finish"
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
controller.Axes.LX.SetState(38)
|
||||
Sleep (500)
|
||||
loop 10 {
|
||||
Press_Triangle(delay:=200)
|
||||
sleep, 200
|
||||
}
|
||||
}
|
||||
else {
|
||||
location := "Start/Finish"
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
Accel_On(100)
|
||||
controller.Axes.LX.SetState(60)
|
||||
CheckMaxTime(maxTime, loopStartTime, TokyoLapCount)
|
||||
CheckTokyoPenServed(TokyoPenServed.startX, TokyoPenServed.startY)
|
||||
}
|
||||
SetFormat, integerfast, d
|
||||
TokyoLapCount++
|
||||
guicontrol,, CurrentLap, Current Lap: %TokyoLapCount% /12
|
||||
ProgressRace := (100/13)*TokyoLapCount
|
||||
guicontrol,, RaceProgress, %ProgressRace%
|
||||
|
||||
if(TokyoLapCount = "13")
|
||||
{
|
||||
location := "Finish line"
|
||||
|
||||
FormatTime, TGTime,, MM/dd hh:mm:ss
|
||||
FileAppend, %TGTime% Race finished.`n, logs.txt
|
||||
url := "https://api.telegram.org/bot" TelegramBotToken "/sendMessage?text=" TGTime ": Race finished.&chat_id=" TelegramChatID
|
||||
hObject:=ComObjCreate("WinHttp.WinHttpRequest.5.1")
|
||||
hObject.Open("GET",url)
|
||||
hObject.Send()
|
||||
|
||||
guicontrol,, CurrentLoop, Current Location: %location%
|
||||
guicontrol,, CurrentLap, GG!
|
||||
controller.Axes.LX.SetState(50)
|
||||
SetFormat, integerfast, d
|
||||
racecounter++
|
||||
SetFormat, integerfast, d
|
||||
racecountertotal++
|
||||
|
||||
; // THIS SESSION
|
||||
SetFormat, integerfast, d
|
||||
SetFormat, FloatFast, 0.2
|
||||
creditcountersession := (835000*racecounter)/1000000
|
||||
SetFormat, integerfast, d
|
||||
SetFormat, FloatFast, 0.2
|
||||
creditavg := creditcountersession/(A_TickCount-script_start)*3600000
|
||||
guicontrol,, RaceCounterSession, Races completed: %racecounter%
|
||||
guicontrol,, ResetCounterSession, Races failed: %resetcounter%
|
||||
guicontrol,, CreditCounterSession, Credits: %creditcountersession% M
|
||||
guicontrol,, CreditAVGSession, Avg./h: %creditavg% M
|
||||
|
||||
; // ALL TIME
|
||||
SetFormat, integerfast, d
|
||||
SetFormat, FloatFast, 0.2
|
||||
creditcountertotal := (835000*racecountertotal)/1000000
|
||||
IniWrite, %racecountertotal%, config.ini,Stats, RaceCounterTotal
|
||||
IniWrite, %resetcountertotal%, config.ini,Stats, ResetCounterTotal
|
||||
guicontrol,, RaceCounterTotal, Races completed: %racecountertotal%
|
||||
guicontrol,, ResetCounterTotal, Races failed: %resetcountertotal%
|
||||
guicontrol,, CreditCounterTotal, Credits: %creditcountertotal% M
|
||||
UpdateAVG(racecounter, script_start)
|
||||
lapcounter =
|
||||
ProgressRace =
|
||||
guicontrol,, RaceProgress, %ProgressRace%
|
||||
loop
|
||||
{
|
||||
restart_found := false
|
||||
c2 := BitGrab(162, 43+remote_play_offsetY, 2)
|
||||
for i, c in c2
|
||||
{
|
||||
d2 := Distance(c, color_restart)
|
||||
SB_SetText(" Searching... " d2 " < 50",2)
|
||||
if (d2 < 10 )
|
||||
{
|
||||
SB_SetText(" Found: Restart Color",2)
|
||||
restart_found := true
|
||||
break
|
||||
}
|
||||
}
|
||||
if (restart_found)
|
||||
break
|
||||
Press_X()
|
||||
Sleep(500)
|
||||
|
||||
}
|
||||
SB_SetText("Found: Restart Color",2)
|
||||
Sleep(260)
|
||||
Press_O()
|
||||
Sleep(200)
|
||||
Press_Right()
|
||||
Sleep(3000)
|
||||
Press_X()
|
||||
Sleep(4000)
|
||||
Press_X()
|
||||
Sleep(4000)
|
||||
guicontrol,, CurrentLoop, Setting up next race.
|
||||
Press_Options()
|
||||
Sleep(1000)
|
||||
Press_Right()
|
||||
Sleep(500)
|
||||
Press_X()
|
||||
controller.Axes.LX.SetState(50)
|
||||
UpdateAVG(racecounter, script_start)
|
||||
Goto, TokyoStart
|
||||
}
|
||||
}
|
||||
}
|
||||
EndRace_Tokyo_Def:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 744 KiB |
BIN
bnowakow/old versions/5 Tokyo/GT7-TOKYO-9.2/config.ini
Normal file
BIN
bnowakow/old versions/5 Tokyo/GT7-TOKYO-9.2/config.ini
Normal file
Binary file not shown.
Reference in New Issue
Block a user