Skip to content

Commit f6c701e

Browse files
eagleivgq4a
authored andcommitted
Common: update PlatformLinux.inl
1 parent d89c35e commit f6c701e

File tree

1 file changed

+138
-3
lines changed

1 file changed

+138
-3
lines changed

src/Common/PlatformLinux.inl

Lines changed: 138 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,10 @@ inline bool strncpy_s(char * dest, size_t, const char * source, size_t num) {
275275
inline bool strncpy_s(char * dest, const char * source, size_t num) {
276276
return NULL == strncpy(dest, source, num);
277277
}
278-
#define strcpy_s(dest, source) (NULL == strcpy(dest, source))
279-
#define strcpy_s(dest, num, source) (NULL == strcpy(dest, source))
280-
#define strcat_s(dest, num, source) (dest == strcat(dest, source))
278+
inline int strcpy_s(char *dest, const char *source) { return (int)(NULL == strcpy(dest, source)); }
279+
inline int strcpy_s(char *dest, size_t num, const char *source) { return (int)(NULL == strcpy(dest, source)); }
280+
inline int strcat_s(char * dest, size_t size, const char * source) { return (NULL == strcat(dest, source)); }
281+
281282
#define _vsnprintf vsnprintf
282283
#define vsprintf_s(dest, size, format, args) vsprintf(dest, format, args)
283284
#define _alloca alloca
@@ -773,5 +774,139 @@ typedef enum _D3DSAMPLERSTATETYPE {
773774
#define D3DFVF_TEXCOORDSIZE3(CoordIndex) (D3DFVF_TEXTUREFORMAT3 << (CoordIndex*2 + 16))
774775
#define D3DFVF_TEXCOORDSIZE4(CoordIndex) (D3DFVF_TEXTUREFORMAT4 << (CoordIndex*2 + 16))
775776

777+
typedef enum _D3DDECLMETHOD {
778+
D3DDECLMETHOD_DEFAULT = 0,
779+
D3DDECLMETHOD_PARTIALU = 1,
780+
D3DDECLMETHOD_PARTIALV = 2,
781+
D3DDECLMETHOD_CROSSUV = 3,
782+
D3DDECLMETHOD_UV = 4,
783+
D3DDECLMETHOD_LOOKUP = 5,
784+
D3DDECLMETHOD_LOOKUPPRESAMPLED = 6
785+
} D3DDECLMETHOD;
786+
787+
788+
#define D3DMAXDECLMETHOD D3DDECLMETHOD_LOOKUPPRESAMPLED
789+
790+
typedef enum _D3DDECLTYPE {
791+
D3DDECLTYPE_FLOAT1 = 0,
792+
D3DDECLTYPE_FLOAT2 = 1,
793+
D3DDECLTYPE_FLOAT3 = 2,
794+
D3DDECLTYPE_FLOAT4 = 3,
795+
D3DDECLTYPE_D3DCOLOR = 4,
796+
D3DDECLTYPE_UBYTE4 = 5,
797+
D3DDECLTYPE_SHORT2 = 6,
798+
D3DDECLTYPE_SHORT4 = 7,
799+
/* VS 2.0 */
800+
D3DDECLTYPE_UBYTE4N = 8,
801+
D3DDECLTYPE_SHORT2N = 9,
802+
D3DDECLTYPE_SHORT4N = 10,
803+
D3DDECLTYPE_USHORT2N = 11,
804+
D3DDECLTYPE_USHORT4N = 12,
805+
D3DDECLTYPE_UDEC3 = 13,
806+
D3DDECLTYPE_DEC3N = 14,
807+
D3DDECLTYPE_FLOAT16_2 = 15,
808+
D3DDECLTYPE_FLOAT16_4 = 16,
809+
D3DDECLTYPE_UNUSED = 17,
810+
} D3DDECLTYPE;
811+
812+
#define D3DMAXDECLTYPE D3DDECLTYPE_UNUSED
813+
814+
typedef enum _D3DDECLUSAGE {
815+
D3DDECLUSAGE_POSITION = 0,
816+
D3DDECLUSAGE_BLENDWEIGHT = 1,
817+
D3DDECLUSAGE_BLENDINDICES = 2,
818+
D3DDECLUSAGE_NORMAL = 3,
819+
D3DDECLUSAGE_PSIZE = 4,
820+
D3DDECLUSAGE_TEXCOORD = 5,
821+
D3DDECLUSAGE_TANGENT = 6,
822+
D3DDECLUSAGE_BINORMAL = 7,
823+
D3DDECLUSAGE_TESSFACTOR = 8,
824+
D3DDECLUSAGE_POSITIONT = 9,
825+
D3DDECLUSAGE_COLOR = 10,
826+
D3DDECLUSAGE_FOG = 11,
827+
D3DDECLUSAGE_DEPTH = 12,
828+
D3DDECLUSAGE_SAMPLE = 13
829+
} D3DDECLUSAGE;
830+
831+
typedef enum _D3DFILLMODE {
832+
D3DFILL_POINT = 1,
833+
D3DFILL_WIREFRAME = 2,
834+
D3DFILL_SOLID = 3,
835+
836+
D3DFILL_FORCE_DWORD = 0x7fffffff
837+
} D3DFILLMODE;
838+
839+
typedef enum _D3DLIGHTTYPE {
840+
D3DLIGHT_POINT = 1,
841+
D3DLIGHT_SPOT = 2,
842+
D3DLIGHT_DIRECTIONAL = 3,
843+
844+
D3DLIGHT_FORCE_DWORD = 0x7fffffff
845+
} D3DLIGHTTYPE;
846+
847+
#ifndef D3DCOLOR_DEFINED
848+
typedef DWORD D3DCOLOR;
849+
#define D3DCOLOR_DEFINED
850+
#endif
851+
852+
typedef enum _D3DSHADEMODE {
853+
D3DSHADE_FLAT = 1,
854+
D3DSHADE_GOURAUD = 2,
855+
D3DSHADE_PHONG = 3,
856+
857+
D3DSHADE_FORCE_DWORD = 0x7fffffff
858+
} D3DSHADEMODE;
859+
860+
typedef enum _D3DSWAPEFFECT {
861+
D3DSWAPEFFECT_DISCARD = 1,
862+
D3DSWAPEFFECT_FLIP = 2,
863+
D3DSWAPEFFECT_COPY = 3,
864+
D3DSWAPEFFECT_OVERLAY = 4,
865+
D3DSWAPEFFECT_FLIPEX = 5,
866+
D3DSWAPEFFECT_FORCE_DWORD = 0xFFFFFFFF
867+
} D3DSWAPEFFECT;
868+
869+
typedef enum _D3DTRANSFORMSTATETYPE {
870+
D3DTS_VIEW = 2,
871+
D3DTS_PROJECTION = 3,
872+
D3DTS_TEXTURE0 = 16,
873+
D3DTS_TEXTURE1 = 17,
874+
D3DTS_TEXTURE2 = 18,
875+
D3DTS_TEXTURE3 = 19,
876+
D3DTS_TEXTURE4 = 20,
877+
D3DTS_TEXTURE5 = 21,
878+
D3DTS_TEXTURE6 = 22,
879+
D3DTS_TEXTURE7 = 23,
880+
881+
D3DTS_FORCE_DWORD = 0x7fffffff
882+
} D3DTRANSFORMSTATETYPE;
883+
884+
#define D3DTS_WORLD D3DTS_WORLDMATRIX(0)
885+
#define D3DTS_WORLD1 D3DTS_WORLDMATRIX(1)
886+
#define D3DTS_WORLD2 D3DTS_WORLDMATRIX(2)
887+
#define D3DTS_WORLD3 D3DTS_WORLDMATRIX(3)
888+
#define D3DTS_WORLDMATRIX(index) (D3DTRANSFORMSTATETYPE)(index + 256)
889+
890+
#define D3DUSAGE_RENDERTARGET __MSABI_LONG(0x00000001)
891+
#define D3DUSAGE_DEPTHSTENCIL __MSABI_LONG(0x00000002)
892+
#define D3DUSAGE_WRITEONLY __MSABI_LONG(0x00000008)
893+
#define D3DUSAGE_SOFTWAREPROCESSING __MSABI_LONG(0x00000010)
894+
#define D3DUSAGE_DONOTCLIP __MSABI_LONG(0x00000020)
895+
#define D3DUSAGE_POINTS __MSABI_LONG(0x00000040)
896+
#define D3DUSAGE_RTPATCHES __MSABI_LONG(0x00000080)
897+
#define D3DUSAGE_NPATCHES __MSABI_LONG(0x00000100)
898+
#define D3DUSAGE_DYNAMIC __MSABI_LONG(0x00000200)
899+
#define D3DUSAGE_AUTOGENMIPMAP __MSABI_LONG(0x00000400)
900+
#define D3DUSAGE_DMAP __MSABI_LONG(0x00004000)
901+
902+
#define D3DCOLOR_ARGB(a,r,g,b) ((D3DCOLOR)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
903+
#define D3DCOLOR_COLORVALUE(r,g,b,a) D3DCOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f))
904+
#define D3DCOLOR_RGBA(r,g,b,a) D3DCOLOR_ARGB(a,r,g,b)
905+
#define D3DCOLOR_XRGB(r,g,b) D3DCOLOR_ARGB(0xff,r,g,b)
906+
#define D3DCOLOR_XYUV(y,u,v) D3DCOLOR_ARGB(0xFF,y,u,v)
907+
#define D3DCOLOR_AYUV(a,y,u,v) D3DCOLOR_ARGB(a,y,u,v)
908+
909+
#define D3DDECL_END() {0xFF,0,D3DDECLTYPE_UNUSED,0,0,0}
776910

777911
inline BOOL SwitchToThread() { return (0 == pthread_yield()); }
912+

0 commit comments

Comments
 (0)