Background: I have a buggy program that decompiles a specific set of files. The bugs are NOT related to the records it is decompiling, just some ancillary things. I am porting the program to AHK to clean up the bugs and add some features.
Issue: Each specific file that it decompiles refers to a mapping structure for each record within that file. Most of these are easy to determine. I've encountered a bitfield expression in one of them and I'm a little confused on how to read it:
#if 1
unsigned char vCombinedBits1;
unsigned char vCombinedBits2;
#else
unsigned char iPadding1_1 : 3;
unsigned char vdirect : 1;
unsigned char vitemspecific : 1;
unsigned char vdamagerelated : 1;
unsigned char vSigned : 1;
unsigned char vSendmyspOther : 1;
unsigned char iPading1 : 1;
unsigned char iPading1_1 : 1;
unsigned char vCSvSigned : 1;
unsigned char vSaved : 1;
unsigned char vfCallback : 1;
unsigned char vfMin : 1;
unsigned char vUpdateAnimRate : 1;
unsigned char iPadding1_2 : 1;
#endif
I'm not a stranger to If/Else logic but I am
a stranger to Visual C++.
My assumed end result of this, based on this and that: Essentially, I'll just read both bytes without regard to the vCombinedBits1 value and map each bit to the variable I need.
Am I correct in assuming that a sample of 0x01 0x14 (0000 0001 0001 0100) will map like this:
iPadding1_1 = 0
iPadding1_1 = 0
iPadding1_1 = 0
vdirect = 0
vitemspecific = 0
vdamagerelated =0
vSigned =0
vSendmyspOther = 1
iPading1 = 0
iPading1_1 = 0
vCSvSigned = 0
vSaved = 1
vfCallback = 0
vfMin = 1
vUpdateAnimRate =0
iPadding1_2 =0
?
Entire structure found here, #if starts at line 649