Question about parsing binary character save data

TrueVision

Member
I have been working on parsing save and item data for a little bit now.
I figure this has to have been answered numerous times before but my Google-fu has its limitations.

I have parsed other item data but Mags are still a mystery to me. Can anyone point out the binary structure for Mag data in the save file or if there's a comprehensive documentation of the save file in general that would be awesome.

It looks like two bytes for each stat but i cant quite make out how its storing the values.

Any help would be appreciated.
 

Soly

Member
Code:
string format = "{0:X4}{1:X2}{2:X2},{3:X4}{4:X4},{5:X4}{6:X4},{7:X2}{8:X2}{9:X2}{10:X2}";

p0 = this.ItemList[this.ItemListSelectedIndex].ID;
p1 = (byte)((int)this.Def + (int)this.Pow + (int)this.Dex + (int)this.Mind);
p2 = this.GetPhotonBlastFlags(this.PhotonBlast1, this.PhotonBlast2, this.PhotonBlast3);
p3 = ((ushort)(this.Def * 100)).ChangeEndianess();
p4 = ((ushort)(this.Pow * 100)).ChangeEndianess();
p5 = ((ushort)(this.Dex * 100)).ChangeEndianess();
p6 = ((ushort)(this.Mind * 100)).ChangeEndianess();
p7 = (byte)(this.Sync);
p8 = (byte)(this.IQ);
p9 = 0;
p9 |= (byte)((this.PhotonBlast1 != 0) ? 1 : 0);
p9 |= (byte)((this.PhotonBlast2 != 0) ? 2 : 0);
p9 |= (byte)((this.PhotonBlast3 != 0) ? 4 : 0);
p9 |= (byte)(this.Present != 0 ? 0x40 : 0);
p10 = (byte)(this.MagColor);

ChangeEndianess is SwapEndian
The stats have 2 decimals which is what the bars in the UI show
 

TrueVision

Member
BOSS! Thanks so much!
Just to clarify, I guess the flags in p9 are:
let flags = 0
flags |= this.Blast1
flags |= this.Blast2 << 1
flags |= this.Blast3 << 2
flags |= this.Present << 6
and then p2 would be the same byte minus the present flag?
 

Soly

Member
p9 says WHICH pb slot has a PB (for some reason, instead of relying on p2), but also p9 says if the mag is wrapped in a present.
Code:
p9 |= (byte)(this.Present != 0 ? 0x40 : 0);

p2 is different, it says WHAT pb is in each slot, but it doesn't depend on p9
 
Top