#ifndef BASETYPES_H_INCLUDED #define BASETYPES_H_INCLUDED typedef unsigned char UInt08; typedef unsigned char U08; typedef signed char Int08; typedef unsigned short UInt16; typedef unsigned short U16; typedef signed short Int16; typedef unsigned int UInt32; typedef unsigned int U32; typedef int Int32; typedef float Flt32; /* 8位共同体 */ typedef union { U08 value; /* 单位访问结构 (single) */ struct { U08 b0 :1; U08 b1 :1; U08 b2 :1; U08 b3 :1; U08 b4 :1; U08 b5 :1; U08 b6 :1; U08 b7 :1; }sbit; /* 双位访问结构1 (double) */ struct { U08 b01 :2; U08 b23 :2; U08 b45 :2; U08 b67 :2; }sbit02; /* 双位访问结构2 (double) */ struct { U08 b0 :1; U08 b12 :2; U08 b34 :2; U08 b56 :2; U08 b7 :1; }sbit12; /* 三位访问结构1 (ternate) */ struct { U08 b02 :3; U08 b35 :3; U08 b67 :2; }sbit03; /* 三位访问结构2 (ternate) */ struct { U08 b0 :1; U08 b13 :3; U08 b46 :3; U08 b7 :1; }sbit13; /* 三位访问结构3 (ternate) */ struct { U08 b01 :2; U08 b24 :3; U08 b57 :3; }sbit23; /* 四位访问结构1 (hex) */ struct { U08 b03 :4; U08 b47 :4; }sbit04; /* 四位访问结构2 (hex) */ struct { U08 b0 :1; U08 b14 :4; U08 b57 :3; }sbit14; /* 四位访问结构3 (hex) */ struct { U08 b01 :2; U08 b25 :4; U08 b67 :2; }sbit24; /* 四位访问结构4 (hex) */ struct { U08 b02 :3; U08 b36 :4; U08 b7 :1; }sbit34; /* 五位访问结构1 (quinary) */ struct { U08 b04 :5; U08 b57 :3; }sbit05; /* 五位访问结构2 (quinary) */ struct { U08 b0 :1; U08 b15 :5; U08 b67 :2; }sbit15; /* 五位访问结构3 (quinary) */ struct { U08 b01 :2; U08 b26 :5; U08 b7 :1; }sbit25; /* 五位访问结构4 (quinary) */ struct { U08 b02 :3; U08 b37 :5; }sbit35; /* 六位访问结构1 (sextuplet) */ struct { U08 b05 :6; U08 b67 :2; }sbit06; /* 六位访问结构2 (sextuplet) */ struct { U08 b0 :1; U08 b16 :6; U08 b7 :1; }sbit16; /* 六位访问结构3 (sextuplet) */ struct { U08 b01 :2; U08 b27 :6; }sbit26; /* 七们访问结构1 (heptad) */ struct { U08 b06 :7; U08 b7 :1; }sbit07; /* 七们访问结构2 (heptad) */ struct { U08 b0 :1; U08 b17 :7; }sbit17; }Un08; /* 16位共同体 */ typedef union { U16 value; /* 单字节访问结构 */ struct { U08 bh; U08 bl; }sbyte; /* 位访问结构 */ struct { Un08 bh; Un08 bl; }sbit; } Un16; /* 32位共同体 */ typedef union { U32 value; /* 单字节访问结构 */ struct { U08 bhh; U08 bhl; U08 blh; U08 bll; }sbyte; /* 位访问结构 */ struct { Un08 bhh; Un08 bhl; Un08 blh; Un08 bll; }sbit; }Un32; typedef struct { Flt32 x, y, z, w; } Vec4f; typedef struct { Int32 x, y, z, w; } Vec4i; typedef struct { Flt32 x, y, z; } Vec3f; typedef struct { Int32 x, y, z; } Vec3i; typedef struct { Flt32 x, y; } Vec2f; typedef struct { Int32 x, y; } Vec2i; typedef struct { Int32 x; Int32 y; Int32 w; Int32 h; } Recti; #define SetVec4(vec4, xx, yy, zz, ww) do{ \ (vec4).x = (xx); \ (vec4).y = (yy); \ (vec4).z = (zz); \ (vec4).w = (ww);}while(0) #define SetVec4f(vec4f, xx, yy, zz, ww) SetVec4(vec4f, xx, yy, zz, ww) #define SetVec4i(vec4i, xx, yy, zz, ww) SetVec4(vec4i, xx, yy, zz, ww) #define SetVec3(vec3, xx, yy, zz) do{ \ (vec3).x = (xx); \ (vec3).y = (yy); \ (vec3).z = (zz);}while(0) #define SetVec3f(vec3f, xx, yy, zz) SetVec3(vec3f, xx, yy, zz) #define SetVec3i(vec3i, xx, yy, zz) SetVec3(vec3i, xx, yy, zz) #define SetVec2(vec2, xx, yy) do{ \ (vec2).x = (xx); \ (vec2).y = (yy);}while(0) #define SetVec2f(vec2f, xx, yy) SetVec2(vec2f, xx, yy) #define SetVec2i(vec2i, xx, yy) SetVec2(vec2i, xx, yy) #define SetRecti(recti, xx, yy, ww, hh) do{ \ (recti).x = (xx); \ (recti).y = (yy); \ (recti).w = (ww); \ (recti).h = (hh);}while(0) #define MAX_MATRIX_STACK_DEPTH 10 //typedef struct //{ // UInt08 idx; // Flt32 mat4x4[MAX_MATRIX_STACK_DEPTH][4*4]; //} Mat4x4Stack; typedef void* (*CommonFun) (void* argv); #ifndef Bool #define Bool Int08 #endif #define INS_FALSE 0x0 #define INS_TRUE 0x1 #define WITHOUT_NORMALS_AND_TEXTCOORDS 0x0 #define WITH_NORMALS 0x1 #define WITH_TEXTCOORDS 0x2 enum { FILE_READ_ERR = 0x10, FILE_WRITE_ERR, FILE_UNKNOW_FORMAT, SYSTEM_ERROR }; #define INS_INVALID_RES_ID 0xffFFffFF typedef struct { Int32 ltx; Int32 lty; Int32 w; Int32 h; UInt08 *dat; UInt32 tex; Int32 fmt; } Image; #define GetImageRect(rect, image) do{\ (rect).x = (image).ltx;\ (rect).y = (image).lty;\ (rect).w = (image).w;\ (rect).h = (image).h;\ }while(0) typedef struct { UInt08 hdr; UInt32 face_num; Flt32 *vtxs; Flt32 *txcs; Flt32 *nors; } Model3DVao, *HModel3DVao; typedef struct { UInt08 hdr; UInt08 idx_type; UInt32 idx_num; UInt32 face_num; UInt32 buf[4]; Flt32 x_min, x_max; Flt32 y_min, y_max; Flt32 z_min, z_max; Flt32 *vtxs; Flt32 *txcs; Flt32 *nors; void *idx; } Model3DVbo, *HModel3DVbo; enum { FRM_COMPRESS_NONE = 0, FRM_COMPRESS_1 = 1, FRM_ENCRYPT_NONE = 0, FRM_ENCRYPT_1 = 1, FRM_TYPE_CTRL = 0, FRM_TYPE_SINGLE = 1, FRM_TYPE_FIRST = 2, FRM_TYPE_NEXT = 3, FRM_INF_HEART_BEAT = 0, FRM_INF_HEART_BEAT_ACK = 1, FRM_INF_START = 2, FRM_INF_START_ACK = 3, FRM_INF_START_NACK = 4, FRM_INF_END = 5, FRM_INF_END_ACK = 6, FRM_INF_END_NACK = 7, FRM_INF_DATA = 8, FRM_INF_DATA_ACK = 9, FRM_SRV_ICM_BLUETOOTH = 0x00, FRM_SRV_ICM_ACCOUNT = 0x01, FRM_SRV_ICM_CTRL = 0x02, FRM_SRV_CDU_NAVIGATION = 0x40, FRM_SRV_CDU_MUSIC = 0x41, FRM_SRV_CDU_RADIO = 0x42, FRM_SRV_CDU_BLUETOOTH = 0x43, FRM_SRV_CDU_WEATHER = 0x44, FRM_SRV_CDU_ACCOUNT = 0x45, FRM_SRV_CDU_AID = 0x46, FRM_SRV_CDU_NOTIFICATION = 0x47, FRM_SRV_CDU_NETRADIO = 0x48, FRM_SRV_CDU_UPGRADE = 0xF0, RPC_TYPE_REQ = 0, RPC_TYPE_RSP = 1, RPC_TYPE_NTF = 2, RPC_CDU_NAVIGATION = 0x00000001, RPC_CDU_MUSIC = 0x00000002, RPC_CDU_RADIO = 0x00000003, RPC_CDU_BLUETOOTH = 0x00000004, RPC_CDU_WEATHER = 0x00000005, RPC_CDU_ACCOUNT = 0x00000006, RPC_CDU_UPGRADE = 0x00000007, RPC_CDU_NOTIFICATION = 0x00000008, RPC_CDU_NETRADIO = 0x00000009, RPC_CDU_SERVICE = 0xff000001, RPC_CDU_HEART_BEAT = 0xff000002, RPC_ICM_BLUETOOTH = 0x0000f001, RPC_ICM_ACCOUNT = 0x0000f002, RPC_ICM_CTRL = 0x0000f003, FRM_SEQ_END = 0, FRM_SEQ_SINGLE = 1, FRM_SEQ_CTRL = 1, }; typedef struct { UInt08 version; /*协议版本*/ UInt08 compress:4; /*压缩类型*/ UInt08 encrypt:4; /*加密类型*/ UInt08 frm_type; /*帧类型*/ UInt08 srv_type; /*服务类型*/ UInt08 frm_info; /*帧信息*/ UInt08 session_id; /*会话ID*/ UInt08 frm_id; /*帧号*/ UInt08 reserve8; /*预留*/ UInt32 data_size; /*数据长度*/ UInt08 reserve13; /*预留*/ UInt08 reserve14; /*预留*/ UInt08 reserve15; /*预留*/ UInt08 reserve16; /*预留*/ } FrameHeader; typedef union { Int08 buff[16]; Un08 unbuf[16]; FrameHeader header; } UnFrameHeader; typedef struct { UInt08 rpc_type; /*RPC类型*/ UInt08 reserve1; /*预留*/ UInt08 reserve2; /*预留*/ UInt08 reserve3; /*预留*/ UInt32 rpc_name; /*RPC名*/ UInt32 rpc_msg_no; /*RPC消息编号*/ UInt32 json_size; /*json数据长度*/ } BpBinHeader; typedef union { Int08 buff[16]; Un08 unbuf[16]; BpBinHeader header; } UnBpBinHeader; #endif // BASETYPES_H_INCLUDED