Hi,
you should look at the XpanderSinglePatchViewer.cpp, it is self explanatory there.
you have OBWORDS_DATA_LENGTH of data to be "repacked" as double byte values, which is not required of course for the patch name (string) that comes afterward.
// for each double byte, repack the value, and set the Patch property accordingly
unsigned char* pByte= (unsigned char*)pPatch;
for (int i=0;i<OBWORDS_DATA_LENGTH;i++) {
// 8th bit of the 8 bits value is the first bit of the high byte
unsigned char cValue = ((shortArray[i] & 0x0100)>>1) | (shortArray[i] & 0x00ff);
*pByte=cValue;
pByte++;
}
unsigned char* pByte= (unsigned char*)pPatch;
for (int i=0;i<OBWORDS_DATA_LENGTH;i++) {
// 8th bit of the 8 bits value is the first bit of the high byte
unsigned char cValue = ((shortArray[i] & 0x0100)>>1) | (shortArray[i] & 0x00ff);
*pByte=cValue;
pByte++;
}
...
// name is 2 bytes/char, high byte never used, thus wchar_t compatible
iReadBytes=0;
iReadBytes=fread(&pPatch->name,sizeof(wchar_t),PATCHNAME_LENGTH,pFile);
assert(iReadBytes==PATCHNAME_LENGTH);
iReadBytes=0;
iReadBytes=fread(&pPatch->name,sizeof(wchar_t),PATCHNAME_LENGTH,pFile);
assert(iReadBytes==PATCHNAME_LENGTH);
Regards,