-
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
62471ff
commit 17a8cef
Showing
7 changed files
with
82 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#include "autorep.h" | ||
#include <time.h> | ||
#include <iostream> | ||
|
||
bool AutoRep_Hooked = false; | ||
|
||
int(__fastcall *orgSaveRep)(DWORD pthis, DWORD unused, const char* path); | ||
|
||
int __fastcall SaveRep(DWORD pthis, DWORD unused, const char* path) { | ||
DWORD len = strlen(path); | ||
if (len > 14 && !strncmp(path + len - 14, "LastReplay.w3g", 14)) { | ||
char whpath[MAX_PATH]; | ||
memset(whpath, 0, MAX_PATH * sizeof(char)); | ||
GetModuleFileName(NULL, whpath, MAX_PATH); | ||
whpath[strrchr(whpath, '\\') - whpath + 1] = 0; | ||
char name[MAX_PATH]; | ||
time_t timep; | ||
time(&timep); | ||
strftime(name, MAX_PATH, "\\Replay\\WHReplay\\%Y_%m_%d_%H_%M_%S.w3g", localtime(&timep)); | ||
strcat(whpath, name); | ||
return orgSaveRep(pthis, unused, whpath); | ||
} | ||
return orgSaveRep(pthis, unused, path); | ||
} | ||
|
||
void AutoRep::Start(DWORD m_GamedllBase, Version m_War3Version) { | ||
if (AutoRep_Hooked) { | ||
return; | ||
} | ||
if (!m_GamedllBase) { | ||
MessageBox(0, "GameDll³õʼ»¯Ê§°Ü", "CrashFixer", 0); | ||
return; | ||
} | ||
DWORD SaveRep_addr = m_GamedllBase; | ||
switch (m_War3Version) { | ||
case Version::v120e: | ||
SaveRep_addr += 0x28D320; | ||
break; | ||
case Version::v124e: | ||
SaveRep_addr += 0x53EE60; | ||
break; | ||
case Version::v127a: | ||
SaveRep_addr += 0x3122C0; | ||
break; | ||
default: | ||
return; | ||
} | ||
InlineHook((void*)SaveRep_addr, SaveRep, (void*&)orgSaveRep); | ||
AutoRep_Hooked = true; | ||
} | ||
|
||
void AutoRep::Stop() { | ||
|
||
} |
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,10 @@ | ||
#pragma once | ||
|
||
#include "hook.h" | ||
|
||
class AutoRep { | ||
public: | ||
void Start(DWORD m_GamedllBase, Version m_War3Version); | ||
void Stop(); | ||
}; | ||
|
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