krisives / d2s-format

Diablo II Save File Format (.d2s format)
121 stars 19 forks source link

checksum code in C language doesn't work well #11

Open JuQiang opened 3 years ago

JuQiang commented 3 years ago

should be add :

if checksum <0 ch = data[i]+1 # add this line checksum = checksum<<1 + che

hashborgir commented 2 years ago
if (uVar < 0) byte++;
uVar = byte + uVar * 2;

or you can left shift once, inclusive OR with shift right 31 bits + byte

uSum = ((uSum << 1) | (uSum >> 31)) + (unsigned)saveFileData[i];