-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ae989b2
commit ddb2559
Showing
6 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#include "showhpbar.h" | ||
|
||
bool ShowHPBar_Patched = false; | ||
bool ShowHPBar_Closed = false; | ||
DWORD is_chat_addr = 0x45CB8C; | ||
|
||
DWORD __stdcall ShowBar(LPVOID lpThreadParameter) { | ||
HWND h_war3 = FindWindow(0, "Warcraft III"); | ||
while (1) | ||
{ | ||
if (ShowHPBar_Closed) { | ||
ExitThread(0); | ||
} | ||
if (*(DWORD*)is_chat_addr) { | ||
continue; | ||
} | ||
keybd_event(219, 0, 0, 0); | ||
keybd_event(221, 0, 0, 0); | ||
Sleep(500); | ||
|
||
/* PostMessage(h_war3, WM_KEYDOWN, 219, 0); | ||
PostMessage(h_war3, WM_KEYDOWN, 221, 0); | ||
PostMessage(h_war3, WM_KEYUP, 219, 0); | ||
PostMessage(h_war3, WM_KEYUP, 221, 0);*/ | ||
} | ||
return 0; | ||
} | ||
|
||
ShowHPBar::ShowHPBar() {} | ||
ShowHPBar::~ShowHPBar() {} | ||
|
||
void ShowHPBar::Start(DWORD m_GamedllBase, Version m_War3Version) { | ||
if (ShowHPBar_Patched) { | ||
return; | ||
} | ||
ShowHPBar_Patched = true; | ||
if (!m_GamedllBase) { | ||
MessageBoxA(0, "GameDll³õʼ»¯Ê§°Ü", "ShowHPBar", 0); | ||
return; | ||
} | ||
switch (m_War3Version) { | ||
case Version::v120e: | ||
break; | ||
default: | ||
return; | ||
} | ||
|
||
|
||
DWORD is_showfps = ReadDwordFromReg("SOFTWARE\\Blizzard Entertainment\\Warcraft III\\Gameplay", "healthbars"); | ||
WriteDwordToReg("SOFTWARE\\Blizzard Entertainment\\Warcraft III\\Gameplay", "healthbars", is_showfps); | ||
if (!is_showfps) { | ||
return; | ||
} | ||
this->thread = CreateThread(NULL, NULL, ShowBar, NULL, NULL, NULL); | ||
} | ||
|
||
void ShowHPBar::Stop() { | ||
ShowHPBar_Closed = true; | ||
Sleep(51); | ||
keybd_event(219, 0, 2, 0); | ||
keybd_event(221, 0, 2, 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#pragma once | ||
#pragma once | ||
|
||
#include "hook.h" | ||
|
||
class ShowHPBar { | ||
public: | ||
ShowHPBar(); | ||
~ShowHPBar(); | ||
void Start(DWORD m_GamedllBase, Version m_War3Version); | ||
void Stop(); | ||
private: | ||
HANDLE thread; | ||
}; | ||
|