Hex-edit Charfile

This forum is for discussions on how to edit what can not be edited through the txt files, needless to say this isn't about battle net hacking.

Moderators: Nefarius, Havvoric

Post Reply
odix
Posts: 32
Joined: Fri Aug 30, 2002 7:45 pm

Hex-edit Charfile

Post by odix » Tue Dec 31, 2002 3:14 am

Hi

Last week we killed some hard-core characters because of an technical problem on our closed realm.
I was able to restore most of them using an simple char-editor.
But some chracters are using new generated set and uniqueitems which makes it impossible to edit them.

So i think the only solution is to edit the files directly with an hex editor.
I created 2 new hc-characters, one dead, one alive and compared the 2 files.

There are only 3 offsets wich were different in the two files.

Add: C

Add: 24

Add: 30

Add:24 only switches between 2C and 24 for dead/alive but i´m not able to figure out wich values i have to imput/calculate for Add: C and Add:30

Can someone help me out of this ?? :cry:

Thx

Odix

User avatar
Paul Siramy
Retired staff
Principality
Posts: 2828
Joined: Sat May 25, 2002 2:39 pm
Location: La Garenne Colombes (near Paris)
Contact:
France

Hand-picked

Post by Paul Siramy » Tue Dec 31, 2002 4:21 am

I don't exactly how it's working, but there is a checksum in the saves, so it's not easy to figure its new value after editing a char.

User avatar
Krabat
Posts: 44
Joined: Fri Jul 05, 2002 11:32 am
Location: germany
Contact:

Post by Krabat » Tue Dec 31, 2002 10:00 am

I am not sure where the byte position in the char file for hardcore dead/alive lies, but the checksum is found at byte 12 and is 4 bytes long.


The checksum code in C++:

// pucData - pointer to the byte stream of the .d2s file
// iSize - number of bytes in the stream ( filesize )
void Checksum( unsigned char *pucData, int iSize )
{
// delete old checksum at offset 0x0C
*((unsigned int*)(pucData+12)) = 0;
// init new checksum with 0
unsigned int uiCS = 0;
// this is the whole checksum calculation
for ( int j = 0; j < iSize; ++j )
uiCS = (uiCS<<1) + pucData[j] + ( uiCS & 0x80000000 ? 1 : 0 );
// write new checksum to stream
*((unsigned int*)(pucData+12)) = uiCS;
}
(credit goes out to: shadowgate hp)



for further information please refer to the d2-char-file-format site:
d2exp file format
kind regards,

Krabat

--------------------------------------------------------
www.darkfluid.com

odix
Posts: 32
Joined: Fri Aug 30, 2002 7:45 pm

Hi

Post by odix » Tue Dec 31, 2002 1:52 pm

Great job i searched at shadowmasters hp several times but i didn´t see this c++ source stuff at all.

thx a lot

Odix

D2Joy
Posts: 3
Joined: Fri Jul 10, 2020 4:08 pm

Re: Hex-edit Charfile

Post by D2Joy » Wed Jul 15, 2020 12:11 am

Krabat wrote:
Tue Dec 31, 2002 10:00 am

uiCS = (uiCS<<1) + pucData[j] + ( uiCS & 0x80000000 ? 1 : 0 );
This line has some mistake, tested one is

Code: Select all

uiCS = ((uiCS<<1)|( uiCS >> 31))+ pucData[j];

Post Reply

Return to “Code Editing”