[Release] Change glow color? Piece of cake =)

Page 1 of 18 12345678911 ... LastLast
Results 1 to 25 of 447
  1. #1
    Hybrid Gembrid is offline
    MemberRank
    Mar 2006 Join Date
    1,121Posts

    [Release] Change glow color? Piece of cake =)

    [For moderatos] - It's release with explanations, so don't move it to the Guide section =)

    Today we will edit glow color in main.exe. The main target is changing items glow(+7 - +13).



    1. We will start from theory.

    There is a function in main.exe that calcs glow color for most of items +7 - +13, and some mobs. For example, for wings, dinorant-model, darkhorse-model and for some other items this function isn't called, but i was wandering how to change glow color, not in making glow items that doesn't have this attribute ;) May be u'll find it out.

    The prototype of this function in c++:
    Code:
    void __cdecl Glow(DWORD dwItemId, DWORD uk1, DWORD uk2, FRGB& cl, BYTE bUkn);
    dwItemId - objectId or index, each object is loaded in a big array of objects, and each object has it's unique index =)

    cl - it's a float RGB struct
    Code:
    struct FRGB
    {
    	float r, g, b; // range of each color [0, 1]
    };
    in this variable glow function returns the result color, there are 30(2 equal blues O_o) default glow colors, but who cares? we will make any color

    uk1 & uk2 - actually these two are floats, and they are used to calc glow color, but we won't use them :D


    bUkn - do u remember 2 kind of balrogs, silver and red? this variable is used only to determine his glow and his bill glow =) silver or red.


    If you've already guessed, we have to hook this function and return the color we want.

    But u'll ask how to find out the real item's Id, because in function we have object's Id. It's simple, all items are displaced in array of objects on some value. Items Ids remain the same as in item.bmd and in item.txt(itemId = ItemType*MaxItemsInType+ItemIndex)

    So if we have ObjectId and Offset of items in array of objects, we can simply calc item's id:
    ItemId = ObjectId - Offset;

    For Example, let's find the item with ObjectId=0x293 and Offset=0x285, with 512 max items in type:

    ItemId = ObjectId - Offset = 0x293 - 0x285 = 0x0E(14)
    ItemType = ItemId / MaxItems = 14 / 512 = 0 (integer division)
    ItemIndex = ItemId % MaxItems = 14 % 512 = 14 (remainder of the integer division)

    if you'll take a look in items.txt or .bmd,
    you'll find that item with Type = 0 and Index = 14 is Lightning Sword

    Later i'll tell you how to find the "Offset" =)
    With these knowledges you can make your own DLL and change glow colors by yourselves, but I made a DLL that will be compatible for people who won't be able to make their own.

    2. DLL

    Here i'll describe the algorithm of the dll.

    This dll supports 32 & 512 MaxItems.
    So the best way for a dll, that will be compatible for all, is memory allocation for all the items -

    Code:
    struct ITEM
    {
    	BYTE bChng; // i'll tell later
    	float r, g, b;
    };
    sizeof(ITEM) = 3*4 + 1 = 13 bytes
    maxtypes = 16

    memory = sizeof(ITEM)*maxtypes*maxitemindex = 208*maxitemindex
    if maxitemindex = *** then memory = 208*32 = 6 656 bytes ~ 6,5 kb
    if maxitemindex = 512, then memory = 208*512 = 106 496 bytes = 104 kb

    For maxitemindex = 512 a lot of memory won't be used at all, but this method allows us to use direct addressing, so it is faster then if we had to find the item in the list of items by it's id; and also this method will help us later =)

    remember ITEM::bChng? we will mark all changed items(i mean glow).
    If item is changed we return our color, if not - we call default glow function.

    Here is our new Glow Proc
    Code:
    void Glow(DWORD dwItemId, DWORD uk1, DWORD uk2, FRGB& fClr, BYTE bUkn)
    {
    
    	int id = dwItemId - g_dwOffset; // calc item id
    
    	// if our object is an item and this item should use our glow and it's not a silver balrog :D
    	// then we return our color
    	// else call the default function
    	if( id >=0 && id < g_MaxItems*16 && Glows[id].bIsChanged  && !bUkn)
    		fClr = Glows[id].fClr;
    	else
    		fnOldGlow(dwItemId, uk1, uk2, fClr, bUkn);
    }
    The Glow Colors dll reads from "glow.gld".
    Format of *.gld files:
    File header:
    Code:
    struct GLOW
    {
    	DWORD signature;	// = 0x574F4C47
    	BYTE bType;	// represents max items, 0 - *** else - 512
    };
    Further, to the end of file, follows items glow info:
    Code:
    struct ITEM
    {
    	USHORT usItemId; // item id
    	FRGB fClr;	// glow color
    };
    So we've hooked glow function, we can now force main.exe to use our colors.

    3. Glow Editor Tool.
    404 Not Found

    Glow Editor allows you:
    -Edit glow color of the items u want,
    since it uses Microsoft Jet(.MDB) database u'll be able to add or remove items, it's simple with MS Access.
    -Load and Save *.gld files for 32 and 512 maxitems versions of main.exe
    -Patch DLL for you main.exe, because function calls and items offset are different
    -DLL's shared memory, using File Mapping, + direct addressing( remember?:) ) allows Glow Editor change colors directly in game.

    4. DLL Patch.

    Glow function calls and items offset are different in different mains, so we have to change these values.
    I'll tell you how to find them using ollydbg, but with 1 condition - main.exe must be unpacked.


    1. Launch main.exe in ollydbg.

    2. Right Button(RB)-> Search for -> all referenced text strings.
    404 Not Found
    http://jpegshare.net/images/76/ac/76...f09be3e91d.jpg

    3. In the appeared window RB -> search for text
    404 Not Found
    http://jpegshare.net/images/eb/ed/eb...2bc575644c.jpg

    4. Type "sword"; Uncheck "Case sensitive" and Check "Entire scope"
    http://img262.imageshack.us/img262/4...chswordlu8.jpg
    http://jpegshare.net/images/b0/d2/b0...87c6b2d924.jpg

    5. Search "Sword" like on the picture using CTR+L(search next)
    http://img187.imageshack.us/img187/6563/03swordvx8.jpg
    http://jpegshare.net/images/81/33/81...3f94ea1ff5.jpg

    6. When you'll find it, double-click or press ENTER on it, and in the main window u should see smth like
    on the picture, the srtring below "Sword" must be "Data\Item" or may be just "Item".

    http://img186.imageshack.us/img186/9215/04foundnr6.jpg
    http://jpegshare.net/images/b9/07/b9...63845bc176.jpg

    7. Above the function call first push command pushes in stack ObjectId. Items types begin from Swords(Type = 0),
    so when main.exe loads models or textures for swords it adds to the item's id the Offset of beginning sword's type section, and if sword's type is the first type of items,
    this offset is the Offset of items in array of objects

    http://img214.imageshack.us/img214/1222/05offsetyq2.jpg
    http://jpegshare.net/images/07/ce/07...ec105bf9ad.jpg

    8. Let's find glow function calls. RB ->search for -> all constants
    http://img262.imageshack.us/img262/7...llconstbh3.jpg
    http://jpegshare.net/images/45/bb/45...a6ebbeca63.jpg

    9. We will search for ObjectId of the Lightning Sword(remember how to calc itemid or object id?)
    ObjectId = Offset(value that you have found) + ItemdId(0*512+14 = 14(0x0E))
    for Offset = 0x285, ObjectId = 0x293

    http://img218.imageshack.us/img218/7...ngswordhr9.jpg
    http://jpegshare.net/images/ea/d5/ea...50a9925c2e.jpg

    10. In the appeared window find 2 Compare Commands
    http://img214.imageshack.us/img214/2...onstantma9.jpg
    http://jpegshare.net/images/5c/cd/5c...3b15dbbc10.jpg

    11. Double-click or ENTER on the FIRST command, and you'll be redirected to it
    http://img262.imageshack.us/img262/7...toconstgq7.jpg
    http://jpegshare.net/images/70/3b/70...a51826cba4.jpg

    12. This is our glow proc, scroll up and find the beginning of it
    http://img214.imageshack.us/img214/4...lowprocsv7.jpg
    http://jpegshare.net/images/c6/8e/c6...33e8285901.jpg

    13. Select first command, then RB -> Go to, and you will see 2 calls for glow function
    http://img262.imageshack.us/img262/5467/11callskr8.jpg
    http://jpegshare.net/images/42/49/42...86134f2d86.jpg

    if u don't have "CALL from X", then RB -> Analyse-> Analyse code, and trye again step 13
    http://img214.imageshack.us/img214/2...analysedz0.jpg
    http://jpegshare.net/images/94/40/94...763fa2b760.jpg

    now with Offset and 2 func Calls you can patch DLL =)


    glowed items


    default glow



    Default Glows [id - R, G, B preview]:
    00 - 1.00, 0.50, 0.00 http://img151.imageshack.us/img151/8288/00ax5.jpg
    01 - 1.00, 0.20, 0.00 http://img151.imageshack.us/img151/1716/01md4.jpg
    02 - 0.00, 0.50, 1.00 http://img151.imageshack.us/img151/693/02go6.jpg
    03 - 0.00, 0.50, 1.00 http://img151.imageshack.us/img151/693/02go6.jpg
    04 - 0.00, 0.80, 0.40 http://img81.imageshack.us/img81/9130/04dh0.jpg
    05 - 1.00, 1.00, 1.00 http://img81.imageshack.us/img81/2693/05oo4.jpg
    06 - 0.60, 0.20, 0.40 http://img86.imageshack.us/img86/7563/06yh3.jpg
    07 - 0.90, 0.80, 1.00 http://img208.imageshack.us/img208/3373/07yp5.jpg
    08 - 0.80, 0.80, 1.00 http://img205.imageshack.us/img205/9941/08ut2.jpg
    09 - 0.50, 0.50, 0.80 http://img404.imageshack.us/img404/8607/09kd8.jpg
    10 - 0.75, 0.65, 0.50 http://img187.imageshack.us/img187/9000/10wz6.jpg
    11 - 0.35, 0.35, 0.60 http://img185.imageshack.us/img185/7017/11nl3.jpg
    12 - 0.47, 0.67, 0.30 http://img205.imageshack.us/img205/7330/12hk1.jpg
    13 - 0.00, 0.30, 0.60 http://img262.imageshack.us/img262/7458/13yo5.jpg
    14 - 0.65, 0.65, 0.55 http://img404.imageshack.us/img404/1964/14us2.jpg
    15 - 0.20, 0.30, 0.60 http://img214.imageshack.us/img214/3042/15io4.jpg
    16 - 0.80, 0.46, 0.25 http://img208.imageshack.us/img208/3078/16vn6.jpg
    17 - 0.65, 0.45, 0.30 http://img205.imageshack.us/img205/1149/17he8.jpg
    18 - 0.50, 0.40, 0.30 http://img404.imageshack.us/img404/2445/18ps6.jpg
    19 - 0.37, 0.37, 1.00 http://img187.imageshack.us/img187/7092/19lo3.jpg
    20 - 0.30, 0.70, 0.30 http://img185.imageshack.us/img185/3805/20yd3.jpg
    21 - 0.50, 0.40, 1.00 http://img205.imageshack.us/img205/9804/21ho9.jpg
    22 - 0.45, 0.45, 0.23 http://img214.imageshack.us/img214/4053/22sa3.jpg
    23 - 0.30, 0.30, 0.45 http://img208.imageshack.us/img208/489/23my8.jpg
    24 - 0.60, 0.50, 0.20 http://img205.imageshack.us/img205/8799/24xf5.jpg
    25 - 0.60, 0.60, 0.60 http://img404.imageshack.us/img404/8000/25xd5.jpg
    26 - 0.30, 0.70, 0.30 http://img187.imageshack.us/img187/2576/26xd7.jpg
    27 - 0.50, 0.60, 0.70 http://img185.imageshack.us/img185/9435/27oh0.jpg
    28 - 0.45, 0.45, 0.23 http://img214.imageshack.us/img214/7489/28nx7.jpg
    29 - 0.45, 0.45, 0.45 forgot to make screen :D

    may be later i will add them to the glow editor


    Glow Editor:
    Glow Editor

    Fixed DLL patcher


    Glow.dll:
    Glow.dll

    Fixed DLL


    Glow.dll goes to MuOnline client's folder
    Glow.gld goes to MuOnline client's Data\ folder
    Don't forget to hook DLL in main.exe

    to create glow.gld, just open the tool then File->Save it will create .gld for you

    not tested with 32 max items, but should work

    Credits:
    1. Hybrid - me, it's my original nick, not [CzF]Hybrid :D
    2 .Fiuz - for me it's problem running server and client on 1 machine, so he made for me items =)
    3. For those who will make mirrors


    Report bugs, errors, mistakes etc...
    Last edited by Gembrid; 22-02-14 at 03:58 PM.


  2. #2
    Account Upgraded | Title Enabled! devil940 is offline
    MemberRank
    Oct 2006 Join Date
    Chibchombia (Colombia)Location
    252Posts

    Re: [Release]Change glow color? Piece of cake =)

    nice i will try

  3. #3
    Account Upgraded | Title Enabled! 1313 is offline
    MemberRank
    Oct 2007 Join Date
    IsraelLocation
    378Posts

    Re: [Release]Change glow color? Piece of cake =)

    Wow!!!!!!!

  4. #4
    Account Upgraded | Title Enabled! SkyLinE27 is offline
    MemberRank
    Mar 2007 Join Date
    LatviaLocation
    349Posts

    Re: [Release]Change glow color? Piece of cake =)

    Nice.10/10

  5. #5
    Account Upgraded | Title Enabled! pentium is offline
    MemberRank
    Jan 2005 Join Date
    (: Pentium Tools :)Location
    279Posts

    Re: [Release]Change glow color? Piece of cake =)

    NIce, pretty full guide

    The first who i know played with glow was sobeih, in his sources... (when he loaded models from la2, he also added them glows...

  6. #6
    Valued Member FiuzMU is offline
    MemberRank
    Jan 2008 Join Date
    MoldovaLocation
    110Posts

    Re: [Release]Change glow color? Piece of cake =)

    10000/10 it is very COOL

  7. #7
    Valued Member _Shotlandetsa_ is offline
    MemberRank
    May 2006 Join Date
    BulgariaLocation
    113Posts

    Re: [Release]Change glow color? Piece of cake =)

    Sorry for my stupid question, but can we change glow for new items From L2 :punch:

  8. #8
    Account Upgraded | Title Enabled! Saint is offline
    MemberRank
    Sep 2007 Join Date
    GermanyLocation
    1,128Posts

    Re: [Release]Change glow color? Piece of cake =)

    That' s a great guide!

  9. #9
    Akaruz - The Legend [hidden] is offline
    MemberRank
    Jun 2006 Join Date
    ClassifiedLocation
    1,120Posts

    Re: [Release]Change glow color? Piece of cake =)

    i've been waiting for this for years now... this is one great help for the mu community.

    thank you very very much.

  10. #10
    Play4Free™ Booms is offline
    MemberRank
    Jun 2005 Join Date
    worldwideLocation
    489Posts

    Re: [Release]Change glow color? Piece of cake =)

    wow,
    we still have some good ppl who share their knowledge with us
    thanks !!!

  11. #11
    Apprentice devilmu is offline
    MemberRank
    Jun 2007 Join Date
    BulgariaLocation
    12Posts

    Re: [Release]Change glow color? Piece of cake =)

    Man you are incredible !!!

  12. #12
    Account Upgraded | Title Enabled! Nachtelf is offline
    MemberRank
    Jun 2005 Join Date
    germanyLocation
    528Posts

    Re: [Release]Change glow color? Piece of cake =)

    10/10, seems like the l2 items etc get a unique glow now ^^

  13. #13
    Hybrid Gembrid is offline
    MemberRank
    Mar 2006 Join Date
    1,121Posts

    Re: [Release]Change glow color? Piece of cake =)

    PPL don't forget to hook the DLL, i was in a hurry and forgot it =)

  14. #14
    Twilight Mu Owner Shagoon is offline
    MemberRank
    Aug 2005 Join Date
    Bucharest, ROLocation
    1,001Posts

    Re: [Release]Change glow color? Piece of cake =)

    Last edited by Shagoon; 25-05-08 at 01:33 PM.

  15. #15
    Alpha Member DaRcAntiX is offline
    MemberRank
    Apr 2005 Join Date
    QLD (Australia)Location
    2,103Posts

    Re: [Release]Change glow color? Piece of cake =)

    2 and a half years later and it's finally done :mrgreen:

    Such a small thing but makes a big difference for modders! Thanks dude!

  16. #16
    Account Upgraded | Title Enabled! RisingKing2010 is offline
    MemberRank
    Feb 2006 Join Date
    loc( 'RisingKing', 'USA' );Location
    1,362Posts

    Re: [Release]Change glow color? Piece of cake =)

    nice job XD... its abt time some1 figured it out

  17. #17
    RZ's most loyal knight Dios is offline
    ModeratorRank
    Apr 2005 Join Date
    ArgentinaLocation
    5,241Posts

    Re: [Release]Change glow color? Piece of cake =)

    Dude, this is fantastic, it's being a long time since this was requested by half the Mu Online community, I love you! xD

  18. #18
    Enthusiast favico is offline
    MemberRank
    Nov 2005 Join Date
    BrasilLocation
    48Posts

    Re: [Release]Change glow color? Piece of cake =)

    it's niceee..
    thx for share.. 100/10

  19. #19
    Novice SmauG is offline
    MemberRank
    Sep 2007 Join Date
    4Posts

    Re: [Release]Change glow color? Piece of cake =)

    This is the best release on last months

    Thanks for share =)

  20. #20
    Member kedar17 is offline
    MemberRank
    Jul 2005 Join Date
    wloclawek-polandLocation
    71Posts

    Re: [Release]Change glow color? Piece of cake =)

    wow amazing job thank you so much

  21. #21
    Member poperon is offline
    MemberRank
    Sep 2006 Join Date
    Brazil.Location
    71Posts

    Re: [Release]Change glow color? Piece of cake =)

    It'll be very Useful for Lineage Items for Example ;D
    Years and Finally it was Released ;P
    Nice Job! 10000000000/10!

  22. #22

    Re: [Release]Change glow color? Piece of cake =)

    Thank you very much. Great guide. 10/10. :thumbsup:

  23. #23
    Valued Member _Shotlandetsa_ is offline
    MemberRank
    May 2006 Join Date
    BulgariaLocation
    113Posts

    Re: [Release]Change glow color? Piece of cake =)

    Quote Originally Posted by Gembrid View Post

    13. Select first command, then RB -> Go to, and you will see 2 calls for glow function
    http://img262.imageshack.us/img262/5467/11callskr8.jpg

    if u don't have "CALL from X", then RB -> Analyse-> Analyse code, and trye again step 13
    http://img214.imageshack.us/img214/2...analysedz0.jpg

    now with Offset and 2 func Calls you can patch DLL =)

    Ok Everything is ok but can someone tell me what to do after Last step i cant understatnd " Now with Offset and 2 func Calls you patch the DLL =) " any help. Sorry for my noobish question . And RESPECT FOR GOOD WORK !

  24. #24
    Hybrid Gembrid is offline
    MemberRank
    Mar 2006 Join Date
    1,121Posts

    Re: [Release]Change glow color? Piece of cake =)

    Quote Originally Posted by _Shotlandetsa_ View Post
    Ok Everything is ok but can someone tell me what to do after Last step i cant understatnd " Now with Offset and 2 func Calls you patch the DLL =) " any help. Sorry for my noobish question . And RESPECT FOR GOOD WORK !
    Run Glow Editor -> Options -> Patch DLL =)

  25. #25

    Re: [Release]Change glow color? Piece of cake =)

    About the hook. Is it like this?
    Code:
    00753F90   .  47 6C 6F 77 2E 64 6C 6C 00     ASCII "Glow.dll",0
    00753F99      00                             DB 00
    00753F9A      00                             DB 00
    00753F9B      00                             DB 00
    00753F9C      00                             DB 00
    00753F9D      00                             DB 00
    00753F9E      00                             DB 00
    00753F9F      00                             DB 00
    00753FA0   >  68 903F7500                    PUSH MainGlow.00753F90                         ; /FileName = "Glow.dll"
    00753FA5   .  E8 CDDD0A7C                    CALL kernel32.LoadLibraryA                     ; \LoadLibraryA



Page 1 of 18 12345678911 ... LastLast

Advertisement