- more byte order logic

- added new network packet debug
This commit is contained in:
Mark Vejvoda
2012-11-01 22:00:55 +00:00
parent 0d88936680
commit 00e075df97
6 changed files with 503 additions and 290 deletions

View File

@@ -68,14 +68,20 @@ template<typename T> class Vec4;
template<class T>
void toEndianVecArray(T *vec, size_t size) {
for(size_t i = 0; i < size; ++i) {
vec[i].toEndian();
static bool bigEndianSystem = Shared::PlatformByteOrder::isBigEndian();
if(bigEndianSystem == true) {
for(size_t i = 0; i < size; ++i) {
vec[i].toEndian();
}
}
}
template<class T>
void fromEndianVecArray(T *vec, size_t size) {
for(size_t i = 0; i < size; ++i) {
vec[i].fromEndian();
static bool bigEndianSystem = Shared::PlatformByteOrder::isBigEndian();
if(bigEndianSystem == true) {
for(size_t i = 0; i < size; ++i) {
vec[i].fromEndian();
}
}
}
@@ -276,12 +282,18 @@ public:
}
void toEndian() {
this->x = Shared::PlatformByteOrder::toCommonEndian(this->x);
this->y = Shared::PlatformByteOrder::toCommonEndian(this->y);
static bool bigEndianSystem = Shared::PlatformByteOrder::isBigEndian();
if(bigEndianSystem == true) {
this->x = Shared::PlatformByteOrder::toCommonEndian(this->x);
this->y = Shared::PlatformByteOrder::toCommonEndian(this->y);
}
}
void fromEndian() {
this->x = Shared::PlatformByteOrder::fromCommonEndian(this->x);
this->y = Shared::PlatformByteOrder::fromCommonEndian(this->y);
static bool bigEndianSystem = Shared::PlatformByteOrder::isBigEndian();
if(bigEndianSystem == true) {
this->x = Shared::PlatformByteOrder::fromCommonEndian(this->x);
this->y = Shared::PlatformByteOrder::fromCommonEndian(this->y);
}
}
};
@@ -524,14 +536,20 @@ public:
}
void toEndian() {
this->x = Shared::PlatformByteOrder::toCommonEndian(this->x);
this->y = Shared::PlatformByteOrder::toCommonEndian(this->y);
this->z = Shared::PlatformByteOrder::toCommonEndian(this->z);
static bool bigEndianSystem = Shared::PlatformByteOrder::isBigEndian();
if(bigEndianSystem == true) {
this->x = Shared::PlatformByteOrder::toCommonEndian(this->x);
this->y = Shared::PlatformByteOrder::toCommonEndian(this->y);
this->z = Shared::PlatformByteOrder::toCommonEndian(this->z);
}
}
void fromEndian() {
this->x = Shared::PlatformByteOrder::fromCommonEndian(this->x);
this->y = Shared::PlatformByteOrder::fromCommonEndian(this->y);
this->z = Shared::PlatformByteOrder::fromCommonEndian(this->z);
static bool bigEndianSystem = Shared::PlatformByteOrder::isBigEndian();
if(bigEndianSystem == true) {
this->x = Shared::PlatformByteOrder::fromCommonEndian(this->x);
this->y = Shared::PlatformByteOrder::fromCommonEndian(this->y);
this->z = Shared::PlatformByteOrder::fromCommonEndian(this->z);
}
}
};
@@ -750,16 +768,22 @@ public:
}
void toEndian() {
this->x = Shared::PlatformByteOrder::toCommonEndian(this->x);
this->y = Shared::PlatformByteOrder::toCommonEndian(this->y);
this->z = Shared::PlatformByteOrder::toCommonEndian(this->z);
this->w = Shared::PlatformByteOrder::toCommonEndian(this->w);
static bool bigEndianSystem = Shared::PlatformByteOrder::isBigEndian();
if(bigEndianSystem == true) {
this->x = Shared::PlatformByteOrder::toCommonEndian(this->x);
this->y = Shared::PlatformByteOrder::toCommonEndian(this->y);
this->z = Shared::PlatformByteOrder::toCommonEndian(this->z);
this->w = Shared::PlatformByteOrder::toCommonEndian(this->w);
}
}
void fromEndian() {
this->x = Shared::PlatformByteOrder::fromCommonEndian(this->x);
this->y = Shared::PlatformByteOrder::fromCommonEndian(this->y);
this->z = Shared::PlatformByteOrder::fromCommonEndian(this->z);
this->w = Shared::PlatformByteOrder::fromCommonEndian(this->w);
static bool bigEndianSystem = Shared::PlatformByteOrder::isBigEndian();
if(bigEndianSystem == true) {
this->x = Shared::PlatformByteOrder::fromCommonEndian(this->x);
this->y = Shared::PlatformByteOrder::fromCommonEndian(this->y);
this->z = Shared::PlatformByteOrder::fromCommonEndian(this->z);
this->w = Shared::PlatformByteOrder::fromCommonEndian(this->w);
}
}
};

View File

@@ -87,6 +87,7 @@ const char *GAME_ARGS[] = {
"--disable-opengl-checks",
"--disable-streflop-checks",
"--debug-network-packets",
"--verbose"
@@ -160,6 +161,8 @@ enum GAME_ARG_TYPE {
GAME_ARG_DISABLE_OPENGL_CAPS_CHECK,
GAME_ARG_DISABLE_STREFLOP_CAPS_CHECK,
GAME_ARG_DEBUG_NETWORK_PACKETS,
GAME_ARG_VERBOSE_MODE,
GAME_ARG_END