Razer Game Booster Fix For Battlefield 3

Razer Game Booster is supposed to automatically enter boost mode when a game is launched and then return to normal mode when the game is closed. This process works fine for most games but not for Battlefield 3. To fix the first part of the issue of entering into boost mode head over to my post Capture Window Events with AutoHotkey.

This next part is where things got a bit tricky. It would’ve been nice if I could have just used my WatchWindows.ahk script to also trigger an event when the BF3 window was closed but AutoHotkey is on Punkbuster’s disallowed programs list. So if you’re running an AHK script while playing BF3 in a PunkBuster enabled server then you’ll eventually get kicked with a disallowed program error. At this point I had to find a new way to trigger an event when BF3 was closed. My first idea was to find a file that got changed only when the BF3 window was closed so I setup TheFolderSpy to monitor the following directories:

C:\ProgramData\Origin
C:\ProgramData\EA Core
C:\ProgramData\EA Logs
C:\ProgramData\Electronic Arts
C:\Users\Peter\AppData\Roaming\Origin
C:\Users\Peter\AppData\Local\Origin
C:\Users\Peter\AppData\Local\Temp
C:\Users\Peter\Documents\Battlefield 3
C:\Program Files (x86)\Origin Games
C:\Program Files (x86)\Origin

Then I launched BF3 and shortly thereafter I closed the game. When I went through the log created by TheFolderSpy I found a .lock file located in C:\ProgramData\EA Core\cache\[temp folder] that was deleted only when BF3 closed. So I setup Hygeia to continuously monitor that folder (including subfolders since the temp folder name changes each time BF3 is launched) and to be triggered only when a file is deleted. Here are the settings I used in Hygeia:
folder-watcher-12-21-2012-000105
folder-watcher-12-21-2012-000106
folder-watcher-12-21-2012-000107

One of the actions I have setup is to launch RazerGameBoosterNormal.ahk which only contains one line of code.
[autoit title=”RazerGameBoosterNormal.ahk”]
SendInput, ^!r
[/autoit]

And that’s it! Now Razer Game Booster will enter boost mode when the BF3 window is launched and will return to normal mode when the window is closed.