Gfx: Add #ifdef _MSC_VER, fix tiled rendering on windows

This only affects when using TILED_RENDERING
This commit is contained in:
retro-wertz 2018-06-08 21:18:32 +08:00
parent 57dc0c25ff
commit edf939e96b
1 changed files with 49 additions and 16 deletions
src/gba

View File

@ -28,24 +28,57 @@ int gfxBG3Y = 0;
int gfxLastVCOUNT = 0;
#ifdef TILED_RENDERING
union uint8_th {
struct
{
/* 0*/ unsigned lo : 4;
/* 4*/ unsigned hi : 4;
} __attribute__((packed));
uint8_t val;
#ifdef _MSC_VER
union uint8_th
{
__pragma( pack(push, 1));
struct
{
#ifdef MSB_FIRST
/* 4*/ unsigned char hi:4;
/* 0*/ unsigned char lo:4;
#else
/* 0*/ unsigned char lo:4;
/* 4*/ unsigned char hi:4;
#endif
}
__pragma(pack(pop));
uint8_t val;
};
#else // !_MSC_VER
union uint8_th
{
struct
{
#ifdef MSB_FIRST
/* 4*/ unsigned char hi:4;
/* 0*/ unsigned char lo:4;
#else
/* 0*/ unsigned char lo:4;
/* 4*/ unsigned char hi:4;
#endif
} __attribute__ ((packed));
uint8_t val;
};
#endif
union TileEntry {
struct
{
/* 0*/ unsigned tileNum : 10;
/*12*/ unsigned hFlip : 1;
/*13*/ unsigned vFlip : 1;
/*14*/ unsigned palette : 4;
};
uint16_t val;
union TileEntry
{
struct
{
#ifdef MSB_FIRST
/*14*/ unsigned palette:4;
/*13*/ unsigned vFlip:1;
/*12*/ unsigned hFlip:1;
/* 0*/ unsigned tileNum:10;
#else
/* 0*/ unsigned tileNum:10;
/*12*/ unsigned hFlip:1;
/*13*/ unsigned vFlip:1;
/*14*/ unsigned palette:4;
#endif
};
uint16_t val;
};
struct TileLine {