unique item filter

Threads that no longer serve a purpose. Read-only.
User avatar
void
Shadowgate Totem
1776 | 98
Common Posting Badge
Posted over 1.000 messages
Great Popularity Badge
Has a thread with over 50.000 views
Common Love Badge
Earned over 20 cookies
Common Guide Badge
Created a complete character guide
edited in dllmain.cpp to test return value of VirtualProtect

Code: Select all

      if(VirtualProtect(hAddress, sizeof(nData), PAGE_EXECUTE_READWRITE, &nOldPage) == 0)
      {
      TerminateProcess(GetCurrentProcess(), -1);
      }
      
      int nReturn = WriteProcessMemory(hGame, hAddress, &nData, sizeof(nData), 0);
      /*VirtualProtect(hAddress, sizeof(nData), nOldPage, 0);*/
      if(VirtualProtect(hAddress, sizeof(nData), nOldPage, 0) == 0)
      {
      TerminateProcess(GetCurrentProcess(), -1);
      }

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

https://msdn.microsoft.com/de-de/librar ... 98(v=vs.85).aspx

strangely enough, with just this change done it closes the d2 window, so that means that the return value is indeed 0 with means that the function has failed, not sure yet what to make of this, but interesting
ticktick
Sasquatch
64 | 9
*1: when using jmp the value given must be a relative address to the current execution address, but the value in hPatch is an absolute address, so it is reduced by the value of the address being written to and by sizeof(int) to because we want to be relative to the executing command, not the command's argument.
*2: this does nothing, it is just so that the casts to void* are not duplicated in VirualProtect and WriteProcessMemory.

the memory changes done by D2TEMPLATE_ApplyPatch are in D2Patch.h. The first value is the DLL to change, second is the address to write to, 3rd is the value to write (E9 is the assembly code for jmp), 4th is nFixMe.
UnDrac
Dark Huntress
12 | 0
@ticktick

In the sample settings file, what does all of that really mean?

Code: Select all

<Dictionary>
        <foo>fa</foo><!-- random value -->
Is "foo" the translated name to make it easier to include/exclude and "fa" is the hex code for whatever we're trying to fiddle with?

Cause I see:

Code: Select all

<Dictionary>
        <Sets>0x05</Sets>
<Quality>
        <Exclude>Sets</Exclude>
Should I assume "Sets" is used as a translation for "0x05" as something that identifies "Set" items?
Or can it just be parts of the name from the items?

I'm trying to figure out how to use the settings file, but I'm failing miserably.
ticktick
Sasquatch
64 | 9
UnDrac wrote:@ticktick

In the sample settings file, what does all of that really mean?

Code: Select all

<Dictionary>
        <foo>fa</foo><!-- random value -->
Is "foo" the translated name to make it easier to include/exclude and "fa" is the hex code for whatever we're trying to fiddle with?

Cause I see:

Code: Select all

<Dictionary>
        <Sets>0x05</Sets>
<Quality>
        <Exclude>Sets</Exclude>
Should I assume "Sets" is used as a translation for "0x05" as something that identifies "Set" items?
Or can it just be parts of the name from the items?

I'm trying to figure out how to use the settings file, but I'm failing miserably.

yes. Sets is translated to 0x05.
Akak_
Pit Knight
109 | 0
can we have a big dictionary then please?:) (need all items qualities) (all items tiers 1-6+sacred) (and what to do with runes/gems (quality of gems), trophies, shrines) - that would be enough for ppl to modify it manually imho, or what is the main problem with this? or maybe there is a link to such a dictionary on phrozen keep etc?
User avatar
krys
Rust Claw
81 | 11
Common Popularity Badge
Has a thread with over 10.000 views
there's no such category as tier1-6 or sacred... every (basic) weapon/armor has 7 variants so it would have to look like that:

Code: Select all

<Dictionary>
   <Club T1>124</Club T1>
   <Club T2>192</Club T2>
   <Club T3>260</Club T3>
   <Club T4>328</Club T4>
   <Club T5>396</Club T5>
   <Club T6>464</Club T6>
   <Club Sacred>25@</Club Sacred>
</Dictionary>


some dictionary entries converted from mxl 2012 txt:

► Sacred Armor

► Sacred Weapons

► Runes

► Perfect Gems
Edited by krys 8 years.
Akak_
Pit Knight
109 | 0
@krys
great work ty vm!!!, it will be useful for us, but here is the problem: if there is no such word like tier quality 1-6 etc, and no possibility to define ranges (there are only 1 item per line definitions as i understood), how can i filter ALL tiered items in <exclude>? only by listing them (300-700 entries) one by one? if i wanna follow the logic: "show everything except those:" ( the most garbage comes from yellow- item and sacred- items, so the main goal to me is to clear all tiered armours and weapons for the beginning (+then some hp/mp potions and tp/id scrolls) - that would be enough for a comfortable gamin, and only after that i can think about filterin rarity, and then addin some exceptions to the rarity filters to exclude some types of armour/weapons when looking for some ethereal items for runewords etc)

► also ive got a few more questions here, ive only started to try it out tho
► errors

//00:28pm gmt+2 (finished modifying this post) u can answer now, ty vm in advance
User avatar
void
Shadowgate Totem
1776 | 98
Common Posting Badge
Posted over 1.000 messages
Great Popularity Badge
Has a thread with over 50.000 views
Common Love Badge
Earned over 20 cookies
Common Guide Badge
Created a complete character guide
im mad srsly, so much time investment in finding the reason for crash and still no concrete findings. i really hope it has something to do with the memory allocation thing ive mentioned yesterday...

look what modification has been made here:

Code: Select all

static const CodePatch gCodePatches[] =
{
   {D2DLL_D2CLIENT,   (DLLBASE_D2CLIENT+0x5907E),   ((DWORD)0x000000E9),         0},
   //{D2DLL_D2CLIENT,   (DLLBASE_D2CLIENT+0x5907F),   ((DWORD)PATCH_DropFilter),   1},
   
   {D2DLL_D2CLIENT,   (DLLBASE_D2CLIENT+0x5907F),   ((DWORD)D2CLIENT_6FB09419),   1},

   {D2DLL_INVALID},   //Must be the last entry in the array!
};

this are the code patches. normally this would make it jump to the filter function, but ive changed it to instead jump straight to the item hide address. and testing confirms, thats exactly what it does when injected. on pressing alt, it wont show any items at all

so it doesnt have anything to do with those addresses being invalid in g++

strangely enough, if i put above code back to default, and instead modify the patch_dropfilter (the file with assembly code) to just jump to that same address it will crash

Code: Select all

void __stdcall PATCH_DropFilter()
{   
    __asm volatile(
    "jmp [%0]                    \n"
    :
    : "r" (D2CLIENT_6FB09419)
    );
}


(im using a compiler instruction to have it run with intel syntax since the .intel command in the script doesnt seem to work)
its very strange that it would crash from that, because its essentially the same thing with just the extra step of first jumping into patch_dropfilter and jumping from there to the same memory address.
if we can figure out what is causing that, then the dll can most likely be made to work as it should
ticktick
Sasquatch
64 | 9
@akak_
1: my large axe was tier 1. i tested using a fresh barbarian character. But otherwise I krys' values are off. They need to be converted from the text code to the numeric code like here. CODE32 reverses the byte order. so r01 would be 00313052 (nul 1 0 r). This can be converted by looking up the characters in http://www.asciitable.com/ (match the red value) and using the value from the HEX column. I'll write a program which will convert an xml file from the string values to the hex numeric values and link it here when complete.

Also note that you cannot have spaces in the names in the dictionary because it's xml. easiest would be to use CamelCase

2: That was just a bad example. having both include and exclude for qualities doesn't make sense because they will never overlap.

3: I don't know the values and I don't know where the old txts are

4: there may be a quality for runes but I don't know.

5: same as 4
Akak_
Pit Knight
109 | 0
with this D2DropFilter.cpp uve linked i can now get many more item codes for various items for my dictionary! ty
also ty vm for this ascii codes table how to use explanation etc etc

IVE SUCCESSFULLY INJECTED IT!!!!!!!! needed to install msxml6.0 uve mentioned and reinstall msc140 (redistributable 2015) some dlls were missin, not ill try some settings work!!!!! :) :)
Edited by Akak_ 8 years.