A
Alhexx
Guest
Well, I'm currently trying to write an editor for Dino Crisis 2 Memory Card Savegames. However, I have one problem, and I have no idea how to solve it.
Here's the important code:
Code: [Select]
Okay, everything's fine 'till now. As you can see (and you can count yourself) t_dc2_player is exactly 10 Bytes big. However, if I use it in another struct, let's take this for example:
Code: [Select]
Now I have this problem: someInt and Dylan are read out right, but ... the others aren't. The reason seems to be than t_dc2_player is not 10 but 12 bytes big in c++ (at least that's what the sizeof() fucntio says)
So, for Dylan 12 Bytes are read out from a file (or another buffer), but only 10 bytes are stored in the struct. The 2 bytes directly after Dylan (or let's say: the first 2 bytes of Regina) simply disappear!! They're not here!!
Has anybody got an idea how to solve this???
- Alhexx
Here's the important code:
Code: [Select]
Code:
typedef unsigned char byte;typedef unsigned short word;typedef unsigned int dword;typedef struct{ // SIZE: 10 Bytes word Unknown1; byte PrimWeapon; byte SecnWeapon; dword Unknown2; word Unknown3;} t_dc2_player;
Okay, everything's fine 'till now. As you can see (and you can count yourself) t_dc2_player is exactly 10 Bytes big. However, if I use it in another struct, let's take this for example:
Code: [Select]
Code:
typedef struct{ int someInt; t_dc2_player Dylan; t_dc2_player Regina; int anotherInt;} someStruct;
Now I have this problem: someInt and Dylan are read out right, but ... the others aren't. The reason seems to be than t_dc2_player is not 10 but 12 bytes big in c++ (at least that's what the sizeof() fucntio says)
So, for Dylan 12 Bytes are read out from a file (or another buffer), but only 10 bytes are stored in the struct. The 2 bytes directly after Dylan (or let's say: the first 2 bytes of Regina) simply disappear!! They're not here!!
Has anybody got an idea how to solve this???
- Alhexx