Skip to content

Commit

Permalink
e
Browse files Browse the repository at this point in the history
  • Loading branch information
AI-M-BOT committed Apr 6, 2021
1 parent cf92048 commit e50ed6b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Crossfirer_v2.x/Crossfirer_Controller.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ CloseOthers()
WinGet, process_count, Count, ahk_class AutoHotkey
Time_Used := A_TickCount - Time_Count
} Until process_count <= 1 || Time_Used > 5000
FileDelete, 助手数据.ini ;删除脚本进程数据
;FileDelete, 助手数据.ini ;删除脚本进程数据

Title_Blank := 0
Loop ;, 10
Expand Down
28 changes: 27 additions & 1 deletion Crossfirer_v2.x/Crossfirer_Functions.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ CheckAdmin(SectionName)
If A_IsAdmin
{
process_id := ProcessInfo_GetCurrentProcessID()
memory_used := GetProcessMemoryInMB(process_id)
IniRead, LAST_PID, 助手数据.ini, %SectionName%, PID
IniWrite, %LAST_PID%, 助手数据.ini, %SectionName%, LASTPID
IniWrite, %process_id%, 助手数据.ini, %SectionName%, PID
IniWrite, %memory_used%, 助手数据.ini, %SectionName%, MEMORY
Return True
}
Else
Expand All @@ -156,9 +160,13 @@ CheckUIA(SectionName)
{
process_id := ProcessInfo_GetCurrentProcessID()
process_name := GetProcessName(process_id)
memory_used := GetProcessMemoryInMB(process_id)
If InStr(process_name, "AutoHotkeyU64_UIA.exe")
{
IniRead, LAST_PID, 助手数据.ini, %SectionName%, PID
IniWrite, %LAST_PID%, 助手数据.ini, %SectionName%, LASTPID
IniWrite, %process_id%, 助手数据.ini, %SectionName%, PID
IniWrite, %memory_used%MB, 助手数据.ini, %SectionName%, MEMORY
Return True
}
Else
Expand All @@ -174,7 +182,7 @@ ProcessInfo_GetCurrentProcessID()
;拷贝自 https://www.reddit.com/r/AutoHotkey/comments/6zftle/process_name_from_pid/ ,通过进程ID得到进程完整路径
GetProcessName(ProcessID)
{
If (hProcess := DllCall("OpenProcess", "uint", 0x0410, "int", 0, "uint", ProcessID, "ptr"))
If (hProcess := DllCall("OpenProcess", "uint", 0x0410, "int", 0, "uint", ProcessID, "ptr"))
{
size := VarSetCapacity(buf, 0x0104 << 1, 0)
If (DllCall("psapi\GetModuleFileNameEx", "ptr", hProcess, "ptr", 0, "ptr", &buf, "uint", size))
Expand All @@ -184,6 +192,24 @@ GetProcessName(ProcessID)
Return False
}
;==================================================================================
;拷贝自jNizM的htopmini.ahk v0.8.3,单位MB,精度两位小数
GetProcessMemoryInMB(PID)
{
pu := "", memory_usage := ""
hProcess := DllCall("OpenProcess", "UInt", 0x001F0FFF, "UInt", 0, "UInt", PID)
if (hProcess)
{
static PMCEX, size := (A_PtrSize = 8 ? 80 : 44), init := VarSetCapacity(PMCEX, size, 0) && NumPut(size, PMCEX)
if (DllCall("K32GetProcessMemoryInfo", "Ptr", hProcess, "UInt", &PMCEX, "UInt", size))
{
pu := { 10 : NumGet(PMCEX, (A_PtrSize = 8 ? 72 : 40), "Ptr") }
}
DllCall("CloseHandle", "Ptr", hProcess)
}
memory_usage := Round(pu[10] / (1024 ** 2), 2)
return memory_usage
}
;==================================================================================
;检查游戏界面真正位置,不包括标题栏和边缘等等,既Client位置
CheckPosition(ByRef Xcp, ByRef Ycp, ByRef Wcp, ByRef Hcp, class_name)
{
Expand Down
2 changes: 2 additions & 0 deletions Crossfirer_v2.x/Crossfirer_NetBlocker.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ Return
Else If (100 > A_TickCount - H_pressed)
Return

press_key("Space", 30, 90) ;跳起来断网可以无敌???

If WinExist("ahk_class HwndWrapper\[NLClientApp.exe;;[\da-f\-]+]") && !GetKeyState("vk87")
{
Net_On := !Net_On
Expand Down

0 comments on commit e50ed6b

Please sign in to comment.