Closed evilC closed 10 years ago
Actually, here is a further improvement - this code will allow the script to be run BEFORE the DX application is run. It will also re-add the overlays if the DX app is killed and restarted.
#SingleInstance, force
#NoEnv
OnExit, GuiClose
#include overlay.ahk
PROC_NAME := "GFXTest.exe"
; http://www.unknowncheats.me/forum/general-programming-and-reversing/105528-gfxtest-lightweight-graphics-testing-application.html
; Thanks to evolution536 and learn_more for this test application :)
SetParam("process", PROC_NAME)
WatchProcess(PROC_NAME)
return
~1::
GuiClose:
DestroyOverlays()
ExitApp
return
WatchProcess(name){
static proc_running := 0
Loop {
ifwinexist, ahk_exe %name%
{
if (!proc_running){
proc_running := 1
CreateOverlays()
}
} else {
if (proc_running){
proc_running := 0
}
}
Sleep 100
}
}
CreateOverlays(){
TextCreate("Arial", 25, false, false, 100, 100, 0xFFFFFFFF, "Hello {ffff00}World", true, true)
BoxCreate(200, 200, 200, 200, 0x10FFFFFF, true)
}
DestroyOverlays(){
DestroyAllVisual()
}
And this one further improves the example by adding a key (2) to toggle the text on and off.
#SingleInstance, force
#NoEnv
OnExit, GuiClose
#include overlay.ahk
PROC_NAME := "GFXTest.exe"
overlay_ids := {}
text_visible := 1
; http://www.unknowncheats.me/forum/general-programming-and-reversing/105528-gfxtest-lightweight-graphics-testing-application.html
; Thanks to evolution536 and learn_more for this test application :)
SetParam("process", PROC_NAME)
;SetParam("process", "MWOClient.exe")
WatchProcess(PROC_NAME)
return
~1::
GuiClose:
DestroyOverlays()
ExitApp
return
~2::
text_visible := 1 - text_visible
TextSetShown(overlay_ids.text,text_visible)
return
WatchProcess(name){
global overlay_ids
static proc_running := 0
Loop {
ifwinexist, ahk_exe %name%
{
if (!proc_running){
proc_running := 1
overlay_ids := CreateOverlays()
}
} else {
if (proc_running){
proc_running := 0
overlay_ids := {}
}
}
Sleep 100
}
}
CreateOverlays(){
ret := {}
ret.text := TextCreate("Arial", 25, false, false, 100, 100, 0xFFFFFFFF, "Hello {ffff00}World", true, true)
ret.box := BoxCreate(200, 200, 200, 200, 0x10FFFFFF, true)
return ret
}
DestroyOverlays(){
DestroyAllVisual()
}
Please create a Pull-Request and I will look over it! :)
Done
The current hello world.ahk leaves the overlays in place if you quit the script.
Suggest changing the script a little, like this:
These changes will make the script remove all injections when it exits / is restarted.