From fef13d3c808f020c1cd55d1ac417cb5a4517167c Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 19 Aug 2021 11:57:32 -0400 Subject: [PATCH 1/2] allow more items to be seen when holding alt --- BH/Modules/Item/Item.cpp | 120 +++++++++++++++++++++++++++++++++++++++ BH/Modules/Item/Item.h | 9 +++ BH/Patch.h | 2 +- 3 files changed, 130 insertions(+), 1 deletion(-) diff --git a/BH/Modules/Item/Item.cpp b/BH/Modules/Item/Item.cpp index 99abe25b..5f946a1f 100644 --- a/BH/Modules/Item/Item.cpp +++ b/BH/Modules/Item/Item.cpp @@ -63,6 +63,9 @@ unsigned int Item::pingLevelSetting = 0; unsigned int Item::trackerPingLevelSetting = -1; UnitAny* Item::viewingUnit; +LPVOID Item::pItemBuf; + + Patch* itemNamePatch = new Patch(Call, D2CLIENT, { 0x92366, 0x96736 }, (int)ItemName_Interception, 6); Patch* itemPropertiesPatch = new Patch(Jump, D2CLIENT, { 0x5612C, 0x2E3FC }, (int)GetProperties_Interception, 6); Patch* itemPropertyStringDamagePatch = new Patch(Call, D2CLIENT, { 0x55D7B, 0x2E04B }, (int)GetItemPropertyStringDamage_Interception, 5); @@ -78,6 +81,19 @@ Patch* permShowItems3 = new Patch(Call, D2CLIENT, { 0x59483, 0x4EA13 }, (int)Per Patch* permShowItems4 = new Patch(Call, D2CLIENT, { 0x5908A, 0x4E61A }, (int)PermShowItemsPatch3_ASM, 6); Patch* permShowItems5 = new Patch(Call, D2CLIENT, { 0xA6BA3, 0x63443 }, (int)PermShowItemsPatch4_ASM, 6); +//credits to rnd2k in DiabloMods discord +Patch* showMoreItems1 = new Patch(Call, D2CLIENT, { 0x58E82, 0x4E412 }, (int)ShowMoreItemsItemsPatch1_ASM, 5); +Patch* showMoreItems2 = new Patch(Call, D2CLIENT, { 0x58F05, 0x4E495 }, (int)ShowMoreItemsItemsPatch2_ASM, 6); +Patch* showMoreItems3 = new Patch(Call, D2CLIENT, { 0x58F2D, 0x4E4BD }, (int)ShowMoreItemsItemsPatch3_ASM, 6); +Patch* showMoreItems4 = new Patch(Call, D2CLIENT, { 0x58F6E, 0x4E4FE }, (int)ShowMoreItemsItemsPatch4_ASM, 6); +Patch* showMoreItems5 = new Patch(Call, D2CLIENT, { 0x58F92, 0x4E522 }, (int)ShowMoreItemsItemsPatch5_ASM, 6); +Patch* showMoreItems6 = new Patch(Call, D2CLIENT, { 0x5909B, 0x4E62B }, (int)ShowMoreItemsItemsPatch6_ASM, 6); +Patch* showMoreItems7 = new Patch(Call, D2CLIENT, { 0x59447, 0x4E9D7 }, (int)ShowMoreItemsItemsPatch7_ASM, 5); + +Patch* showMoreItems8 = new Patch(NOP, D2CLIENT, { 0x58E57, 0x4E3E7 }, 0, 3); +Patch* showMoreItems9 = new Patch(JumpRelative, D2CLIENT, { 0x58E5A, 0x4E3EA }, (int)0x1C, 2); +Patch* showMoreItems10 = new Patch(NOP, D2CLIENT, { 0x59087, 0x4E617 }, 0, 9); + using namespace Drawing; void Item::OnLoad() { @@ -97,6 +113,19 @@ void Item::OnLoad() { itemPropertyStringDamagePatch->Install(); itemPropertyStringPatch->Install(); + // 0x120 bytes per item = ~ maximum 3500 items per screen + Item::pItemBuf = VirtualAlloc(0, 0xF7000, MEM_COMMIT + MEM_RESERVE, PAGE_READWRITE); + showMoreItems1->Install(); + showMoreItems2->Install(); + showMoreItems3->Install(); + showMoreItems4->Install(); + showMoreItems5->Install(); + showMoreItems6->Install(); + showMoreItems7->Install(); + showMoreItems8->Install(); + showMoreItems9->Install(); + showMoreItems10->Install(); + if (Toggles["Show Ethereal"].state || Toggles["Show Sockets"].state || Toggles["Show iLvl"].state || Toggles["Color Mod"].state || Toggles["Show Rune Numbers"].state || Toggles["Alt Item Style"].state || Toggles["Shorten Item Names"].state || Toggles["Advanced Item Display"].state) itemNamePatch->Install(); @@ -1426,3 +1455,94 @@ void __declspec(naked) PermShowItemsPatch4_ASM() ret } } + +// MOV EAX,OFFSET pBuf +__declspec(naked) void ShowMoreItemsItemsPatch1_ASM() { + __asm + { + mov eax, Item::pItemBuf + retn + } +} + +//MOV EAX,DWORD PTR DS:[EAX+pBuf] +__declspec(naked) void ShowMoreItemsItemsPatch2_ASM() { + __asm + { + pushfd + push esi + mov esi, Item::pItemBuf + mov eax, [eax + esi] + pop esi + popfd + retn + } +} + +//MOV EAX,DWORD PTR DS:[ECX+pBuf+0x8] +__declspec(naked) void ShowMoreItemsItemsPatch3_ASM() { + __asm + { + pushfd + push esi + mov esi, Item::pItemBuf + add esi, 0x8 + mov eax, [ecx + esi] + pop esi + popfd + retn + } +} + +//MOV EAX,DWORD PTR DS:[EAX+pBuf+0x4] +__declspec(naked) void ShowMoreItemsItemsPatch4_ASM() { + __asm + { + pushfd + push esi + mov esi, Item::pItemBuf + add esi, 0x4 + mov eax, [eax + esi] + pop esi + popfd + retn + } +} + +//MOV EAX,DWORD PTR DS:[ECX+pBuf+0xC] +__declspec(naked) void ShowMoreItemsItemsPatch5_ASM() { + __asm + { + pushfd + push esi + mov esi, Item::pItemBuf + add esi, 0xC + mov eax, [ecx + esi] + pop esi + popfd + retn + } +} + +//ADD EBP,OFFSET pBuf +__declspec(naked) void ShowMoreItemsItemsPatch6_ASM() { + __asm + { + pushfd + add ebp, Item::pItemBuf + popfd + retn + } +} + +//MOV ESI,OFFSET pBuf+0x118 +__declspec(naked) void ShowMoreItemsItemsPatch7_ASM() { + __asm + { + pushfd + mov esi, Item::pItemBuf + add esi, 0x118 + popfd + retn + } +} \ No newline at end of file diff --git a/BH/Modules/Item/Item.h b/BH/Modules/Item/Item.h index 15f27427..47bffb9e 100644 --- a/BH/Modules/Item/Item.h +++ b/BH/Modules/Item/Item.h @@ -62,6 +62,7 @@ class Item : public Module { static unsigned int filterLevelSetting; static unsigned int pingLevelSetting; static unsigned int trackerPingLevelSetting; + static LPVOID pItemBuf; void ResetPatches(); public: @@ -113,6 +114,14 @@ void PermShowItemsPatch2_ASM(); void PermShowItemsPatch3_ASM(); void PermShowItemsPatch4_ASM(); +void ShowMoreItemsItemsPatch1_ASM(); +void ShowMoreItemsItemsPatch2_ASM(); +void ShowMoreItemsItemsPatch3_ASM(); +void ShowMoreItemsItemsPatch4_ASM(); +void ShowMoreItemsItemsPatch5_ASM(); +void ShowMoreItemsItemsPatch6_ASM(); +void ShowMoreItemsItemsPatch7_ASM(); + struct UnitItemInfo; int CreateUnitItemInfo(UnitItemInfo *uInfo, UnitAny *item); diff --git a/BH/Patch.h b/BH/Patch.h index bfbf83ab..3625337d 100644 --- a/BH/Patch.h +++ b/BH/Patch.h @@ -6,7 +6,7 @@ class Patch; enum Dll { D2CLIENT=0,D2COMMON,D2GFX,D2LANG,D2WIN,D2NET,D2GAME,D2LAUNCH,FOG,BNCLIENT, STORM, D2CMP, D2MULTI, D2MCPCLIENT}; -enum PatchType { Jump=0xE9, Call=0xE8, NOP=0x90, Push=0x6A }; +enum PatchType { Jump=0xE9, Call=0xE8, NOP=0x90, Push=0x6A, JumpRelative = 0xEB }; struct Offsets { int _113c; From 8fdb83194323d8855ab305c33c1115ab9bbc2a46 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 19 Aug 2021 12:04:04 -0400 Subject: [PATCH 2/2] allow more items to be seen when holding alt --- BH/Modules/Item/Item.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/BH/Modules/Item/Item.cpp b/BH/Modules/Item/Item.cpp index 5f946a1f..3541f22a 100644 --- a/BH/Modules/Item/Item.cpp +++ b/BH/Modules/Item/Item.cpp @@ -159,6 +159,7 @@ void Item::LoadConfig() { BH::config->ReadToggle("Alt Item Style", "None", true, Toggles["Alt Item Style"]); BH::config->ReadToggle("Color Mod", "None", false, Toggles["Color Mod"]); BH::config->ReadToggle("Shorten Item Names", "None", false, Toggles["Shorten Item Names"]); + BH::config->ReadToggle("Show More Items", "None", true, Toggles["Show More Items"]); BH::config->ReadToggle("Always Show Items", "None", false, Toggles["Always Show Items"]); BH::config->ReadToggle("Advanced Item Display", "None", false, Toggles["Advanced Item Display"]); BH::config->ReadToggle("Item Drop Notifications", "None", false, Toggles["Item Drop Notifications"]); @@ -215,6 +216,30 @@ void Item::ResetPatches() { permShowItems4->Remove(); permShowItems5->Remove(); } + + if (Toggles["Show More Items"].state) { + showMoreItems1->Install(); + showMoreItems2->Install(); + showMoreItems3->Install(); + showMoreItems4->Install(); + showMoreItems5->Install(); + showMoreItems6->Install(); + showMoreItems7->Install(); + showMoreItems8->Install(); + showMoreItems9->Install(); + showMoreItems10->Install(); + } else { + showMoreItems1->Remove(); + showMoreItems2->Remove(); + showMoreItems3->Remove(); + showMoreItems4->Remove(); + showMoreItems5->Remove(); + showMoreItems6->Remove(); + showMoreItems7->Remove(); + showMoreItems8->Remove(); + showMoreItems9->Remove(); + showMoreItems10->Remove(); + } } void Item::DrawSettings() { @@ -250,6 +275,10 @@ void Item::DrawSettings() { new Keyhook(settingsTab, keyhook_x, y+2, &Toggles["Shorten Item Names"].toggle, ""); y += 15; + new Checkhook(settingsTab, 4, y, &Toggles["Show More Items"].state, "Show More Items"); + new Keyhook(settingsTab, keyhook_x, y + 2, &Toggles["Show More Items"].toggle, ""); + y += 15; + new Checkhook(settingsTab, 4, y, &Toggles["Always Show Items"].state, "Always Show Items"); new Keyhook(settingsTab, keyhook_x, y + 2, &Toggles["Always Show Items"].toggle, ""); y += 15;