Sign in to follow this  
Followers 0
FaridAgl

Game Start Notifier - Need a little help

5 posts in this topic

Guys i want share my tool then i hope you help me.

there is a popular game named Warcraft III, i made a tool using NomadMemory to check game status, actually it's a Game Start Notifier.

Let me explain, You run Warcraft III, (i mean for online game), then you join a host and wait until the host be full (for example 10/10 for DotA), then host will start the game, few second for loading and the game start. so what i'm going to do, i made this tool that will check an address of Warcraft III's memory and when that address is = 1 it mean the game is started and my tool will play a sound to notify the user that game has been started. It's usefull when you should wait about 5 minutes to host be full and you want minimize your game and do your other things until game start.

everything is ok and it's working fine but...

Warcraft III has serveral Patches (1.24b - 1.24e - 1.25b - 1.26a) and the address that i should check is different for each cases.

I just used "ProcessGetLocation" and it's working fine for finding every process's exact location but not Warcraft III !!! i can't figure out what is the problem.

I want find the process's location and use FileGetVersion() and it will be done.

it's my code so far:

;~ Includes
#include <NomadMemory.au3>
#include <Misc.au3>

;~ Options
#NoTrayIcon
If _Singleton("Game Start Notifier", 1) = 0 Then
    MsgBox(48, "Game Start Notifier", "Another instance of Game Start Notifier is running.")
    Exit
EndIf
Opt("WinTitleMatchMode", 3)


If WinExists("[CLASS:Warcraft III]") Then
    MsgBox(64, "Game Start Notifier", "Game Start Notifier is now running." & @CRLF & "It will close automatically when you close Warcraft III.")
Else
    MsgBox(48, "Game Start Notifier", "Run Warcraft III and then try again.")
    Exit
EndIf

GUICreate("Game Start Notifier")

While 1

    SetPrivilege("SeDebugPrivilege", 1)
    $PID = ProcessExists("war3.exe")
    $Process = _MemoryOpen($PID)

    $ModuleBaseAddress = _MemoryModuleGetBaseAddress($PID, "Game.dll")
    $TrimBaseAddress = StringTrimLeft($ModuleBaseAddress, 2)
    $FinalBaseAddress = StringTrimRight($TrimBaseAddress, 6)

    $FinalAddress = "0x" & $FinalBaseAddress & "AE64D8"
    Global $Value = _MemoryRead($FinalAddress, $Process) ; 1.24b & 1.24e

    $FinalAddress = "0x" & $FinalBaseAddress & "ACF678"
    Global $Value = _MemoryRead($FinalBaseAddress, $Process) ; 1.25b & 1.26a

    $Value = _MemoryRead($FinalAddress, $Process)

    _MemoryClose($Process)
    If $Value = 1 Then
        If $State = 0 Then
            SoundPlay("Game.mp3", 0)
        EndIf
        $State = 1
    ElseIf $Value = 0 Then
        $State = 0
    EndIf

    Sleep(250)

    If ProcessExists("war3.exe") = 0 Then
        Exit
    EndIf
WEnd

amd it's ProcessGetLocation function that i'm going to use (but does'nt work just for Warcraft III):

$GetPath = _ProcessGetLocation("war3.exe")
If $GetPath = -1 Then
    MsgBox(16, "Error", "Unable get process path")
Else
    MsgBox(0, "Success", $GetPath)
EndIf
Func _ProcessGetLocation($sProc = @ScriptFullPath)
    Local $iPID = ProcessExists($sProc)
    If $iPID = 0 Then Return SetError(1, 0, -1)
    Local $aProc = DllCall('kernel32.dll', 'hwnd', 'OpenProcess', 'int', BitOR(0x0400, 0x0010), 'int', 0, 'int', $iPID)
    If $aProc[0] = 0 Then Return SetError(1, 0, -1)
    Local $vStruct = DllStructCreate('int[1024]')
    DllCall('psapi.dll', 'int', 'EnumProcessModules', 'hwnd', $aProc[0], 'ptr', DllStructGetPtr($vStruct), 'int', DllStructGetSize($vStruct), 'int*', 0)
    Local $aReturn = DllCall('psapi.dll', 'int', 'GetModuleFileNameEx', 'hwnd', $aProc[0], 'int', DllStructGetData($vStruct, 1), 'str', '', 'int', 2048)
    If StringLen($aReturn[3]) = 0 Then Return SetError(2, 0, '')
    Return $aReturn[3]
EndFunc   ;==>_ProcessGetLocation

if you can't understand any thing just ask, and 10x so much

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

It seems a good idea but unfortunely we can not discuss game automation here.. read the forum rules please

Edited by monoscout999

Share this post


Link to post
Share on other sites

Oh my god, it's not game automation in any case, it just play a sound when game started, so if your game is minimized you will be noticed, that's all.

BTW i just want to know why ProcessGetLocation() doesn't work for some process.

Share this post


Link to post
Share on other sites

he already read them, more than once, and he still ask similar questions, thread reported


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

Oh my god, it's not game automation

You are quite clearly wrong. Thread locked. Do not try to argue your point, you will leave the forum if you do. Do not create a new thread asking the same question, you will leave the forum for that as well.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0