Skip to content

Commit

Permalink
NM -> Hell congrats screen button fix (#14)
Browse files Browse the repository at this point in the history
Add interception at congrats screen to fix hell button after finishing nightmare
  • Loading branch information
imbalanced authored and noah- committed Nov 19, 2018
1 parent 95b3708 commit 878ceb2
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 1 deletion.
8 changes: 8 additions & 0 deletions D2Handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,14 @@ void GameDrawOOG(void) {
Sleep(10);
}

void SetMaxDiff(void) {
if (D2CLIENT_GetDifficulty() == 1 && *p_D2CLIENT_ExpCharFlag) {
BnetData* pData = *p_D2LAUNCH_BnData;
if (pData)
pData->nMaxDiff = 10;
}
}

void __stdcall AddUnit(UnitAny* lpUnit) {
// EnterCriticalSection(&Vars.cUnitListSection);
// Vars.vUnitList.push_back(make_pair<DWORD, DWORD>(lpUnit->dwUnitId, lpUnit->dwType));
Expand Down
1 change: 1 addition & 0 deletions D2Handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ DWORD __fastcall GamePacketReceived(BYTE* pPacket, DWORD dwSize);
DWORD __fastcall GamePacketSent(BYTE* pPacket, DWORD dwSize);
void __fastcall GameResetFrames(UnitAny* pOwner);
void GameDrawOOG(void);
void SetMaxDiff(void);
void __stdcall AddUnit(UnitAny* lpUnit);
void __stdcall RemoveUnit(UnitAny* lpUnit);
void __fastcall WhisperHandler(char* szAcc, char* szText);
Expand Down
11 changes: 11 additions & 0 deletions D2Intercepts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,17 @@ void GameDrawOOG_Intercept(void) {
GameDrawOOG();
}

void __declspec(naked) CongratsScreen_Intercept(void) {
__asm
{
call D2CLIENT_CongratsScreen_I
pushad
call SetMaxDiff
popad
retn
}
}

void __declspec(naked) GameActChange_Intercept(void) {
__asm
{
Expand Down
1 change: 1 addition & 0 deletions D2Intercepts.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ void GameAttack_Intercept();
void PlayerAssignment_Intercept();
void GameCrashFix_Intercept();
void GameDrawOOG_Intercept(void);
void CongratsScreen_Intercept(void);
void GameActChange_Intercept(void);
void GameActChange2_Intercept(void);
void GameLeave_Intercept(void);
Expand Down
2 changes: 2 additions & 0 deletions D2Ptrs.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ enum {

ASMPTR(D2CLIENT, GameLeave_I, 0x81830) // Updated 1.14d //00481830-BASE

ASMPTR(D2CLIENT, CongratsScreen_I, 0xF6190) // Updated 1.14d //004F6190-BASE

// ASMPTR(D2CLIENT, ClickMap_I, 0x11C8B4) //6FBCC8B4
// ASMPTR(D2CLIENT, ClickMap_II, 0x11D2CC)//6FBCD2CC //MoveOn
// ASMPTR(D2CLIENT, ClickMap_III, 0x5BB50)//ClickMap_III //CallOne
Expand Down
2 changes: 1 addition & 1 deletion Patch.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PatchHook Patches[] = {
{PatchJmp, GetDllOffset("D2Client.dll", 0x5E4D5), (DWORD)PlayerAssignment_Intercept, 5}, // Updated 1.14d //0045E4D5-BASE
{PatchBytes, GetDllOffset("D2Client.dll", 0x68770), (DWORD)0xc3, 1}, // Updated 1.14d //00468770-BASE
{PatchBytes, GetDllOffset("D2CLIENT.DLL", 0x4EBFB), (BYTE)0x75, 1}, // Congrats Screen //0044EBFB-BASE
{PatchBytes, GetDllOffset("D2CLIENT.DLL", 0x4660A), (BYTE)0x09, 1}, // Hell Button Fix //0044660A-BASE
{PatchCall, GetDllOffset("D2Client.dll", 0x4EBEF), (DWORD)CongratsScreen_Intercept, 5}, // Updated 1.14d //0044EBEF-BASE
{PatchCall, GetDllOffset("D2Client.dll", 0x547B6), (DWORD)GameActChange_Intercept, 5}, // Updated 1.14d //004547B6-BASE
{PatchJmp, GetDllOffset("D2Client.dll", 0x567EB), (DWORD)GameActChange2_Intercept, 5}, // Updated 1.14d //004567EB-BASE
{PatchCall, GetDllOffset("D2Client.dll", 0x4F57C), (DWORD)GameLeave_Intercept, 5}, // Updated 1.14d //0044F57C-BASE
Expand Down

0 comments on commit 878ceb2

Please sign in to comment.