SPS2 - Direct PS2 Access Environment - Forums


Summary |  Forums |  Bugs |  News |  Source |  Files | 

Discussion Forums: Developers

Admin

Message: 41812
BY: mrm
DATE: 2004-Mar-07 05:57
SUBJECT: Sizes of union-members don't match

Hello there, once again.
I don't know if its a bug or a feature, but perhaps you should take a closer look at this struct from sps2tags.h:

typedef union {
sps2uint64 i64;

struct {
unsigned int QWC : 16;
unsigned int _PAD1 : 10;
unsigned int PCE : 2;
DMA_ID_t ID : 3;
unsigned int IRQ : 1;
unsigned int ADDR : 31;
unsigned int SPR : 1;
unsigned int _PAD2 : 32;
unsigned int _PAD3 : 32;
} s;
} sps2DMATag_t;

"sps2uint64 i64" is 64 bits long and "s" is 128 bits long. So the total size is 128.

This basically wouldn't hurt anyone, unless there was a previous version of sps2 in which this struct was 64 bits wide.

HSFortuna considers it to be 64 bits in his tutorials and uses something like "dmatag += 2" to increment the pointer and move to the next dmatag in memory.
So all his tutorials which have to do with dma-tags are broken now. (I have not had the time to try them all out, but I think that they are broken).

--

I personally use the following statement:
(unsigned char *) dmatag += 8;
This works in both cases.

Mr.M


 

Thread View

Thread Author Date
Sizes of union-members don't matchmrm2004-Mar-07 05:57
      small typomrm2004-Mar-07 06:02
      RE: Sizes of union-members don't matchsauce2004-Mar-07 08:28

 

Post a followup to this message

You could post if you were [logged in]