More thorough checksums. Incompatible with earlier builds.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2480 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2006-10-29 04:53:36 +00:00
parent fc45a926d5
commit 818f9fbaf4
3 changed files with 55 additions and 6 deletions
+1 -1
View File
@@ -258,7 +258,7 @@ DoBattle (BATTLE_STATE *bs)
Checksum checksum; Checksum checksum;
crc_init(&state); crc_init(&state);
crc_processDispQueue (&state); crc_processState (&state);
checksum = (Checksum) crc_finish (&state); checksum = (Checksum) crc_finish (&state);
sendChecksumConnections ((uint32) battleFrameCount, sendChecksumConnections ((uint32) battleFrameCount,
+45 -4
View File
@@ -29,6 +29,7 @@
#include "netconnection.h" #include "netconnection.h"
#include "netmelee.h" #include "netmelee.h"
#include "libs/log.h" #include "libs/log.h"
#include "libs/mathlib.h"
#include "libs/misc.h" #include "libs/misc.h"
@@ -61,7 +62,6 @@ crc_processVELOCITY_DESC(crc_State *state, const VELOCITY_DESC *val) {
#endif #endif
} }
#if 0
void void
crc_processPOINT(crc_State *state, const POINT *val) { crc_processPOINT(crc_State *state, const POINT *val) {
#ifdef DUMP_CRC_OPS #ifdef DUMP_CRC_OPS
@@ -74,6 +74,7 @@ crc_processPOINT(crc_State *state, const POINT *val) {
#endif #endif
} }
#if 0
void void
crc_processSTAMP(crc_State *state, const STAMP *val) { crc_processSTAMP(crc_State *state, const STAMP *val) {
#ifdef DUMP_CRC_OPS #ifdef DUMP_CRC_OPS
@@ -99,6 +100,11 @@ crc_processINTERSECT_CONTROL(crc_State *state, const INTERSECT_CONTROL *val) {
} }
#endif #endif
void
crc_processSTATE(crc_State *state, const STATE *val) {
crc_processPOINT(state, &val->location);
}
void void
crc_processELEMENT(crc_State *state, const ELEMENT *val) { crc_processELEMENT(crc_State *state, const ELEMENT *val) {
#ifdef DUMP_CRC_OPS #ifdef DUMP_CRC_OPS
@@ -124,6 +130,8 @@ crc_processELEMENT(crc_State *state, const ELEMENT *val) {
crc_processBYTE(state, val->thrust_wait); crc_processBYTE(state, val->thrust_wait);
crc_processVELOCITY_DESC(state, &val->velocity); crc_processVELOCITY_DESC(state, &val->velocity);
crc_processSTATE(state, &val->current);
crc_processSTATE(state, &val->next);
#ifdef DUMP_CRC_OPS #ifdef DUMP_CRC_OPS
log_add(log_Debug, "END crc_processELEMENT()."); log_add(log_Debug, "END crc_processELEMENT().");
#endif #endif
@@ -136,8 +144,7 @@ crc_processDispQueue(crc_State *state) {
#ifdef DUMP_CRC_OPS #ifdef DUMP_CRC_OPS
size_t i = 0; size_t i = 0;
log_add(log_Debug, "START crc_processDispQueue() (frame %u).", log_add(log_Debug, "START crc_processDispQueue().");
battleFrameCount);
#endif #endif
for (element = GetHeadElement(); element != 0; element = nextElement) { for (element = GetHeadElement(); element != 0; element = nextElement) {
ELEMENTPTR elementPtr; ELEMENTPTR elementPtr;
@@ -156,7 +163,41 @@ crc_processDispQueue(crc_State *state) {
#endif #endif
} }
#ifdef DUMP_CRC_OPS #ifdef DUMP_CRC_OPS
log_add(log_Debug, "END crc_processDispQueue() (frame %u).", log_add(log_Debug, "END crc_processDispQueue().");
#endif
}
void
crc_processRNG(crc_State *state) {
DWORD seed;
#ifdef DUMP_CRC_OPS
log_add(log_Debug, "START crc_processRNG().");
#endif
seed = TFB_SeedRandom(0);
// This modifies the seed too.
crc_processDWORD(state, seed);
TFB_SeedRandom(seed);
// Restore the old seed.
#ifdef DUMP_CRC_OPS
log_add(log_Debug, "END crc_processRNG().");
#endif
}
void
crc_processState(crc_State *state) {
#ifdef DUMP_CRC_OPS
log_add(log_Debug, "--------------------\n"
"START crc_processState() (frame %u).", battleFrameCount);
#endif
crc_processRNG(state);
crc_processDispQueue(state);
#ifdef DUMP_CRC_OPS
log_add(log_Debug, "END crc_processState() (frame %u).",
battleFrameCount); battleFrameCount);
#endif #endif
} }
+9 -1
View File
@@ -50,6 +50,11 @@ crc_processBYTE(crc_State *state, BYTE val) {
crc_processUint8(state, (uint8) val); crc_processUint8(state, (uint8) val);
} }
static inline void
crc_processDWORD(crc_State *state, DWORD val) {
crc_processUint32(state, (uint32) val);
}
static inline void static inline void
crc_processCOORD(crc_State *state, COORD val) { crc_processCOORD(crc_State *state, COORD val) {
crc_processUint16(state, (uint16) val); crc_processUint16(state, (uint16) val);
@@ -64,14 +69,17 @@ crc_processTIME_VALUE(crc_State *state, const TIME_VALUE val) {
void crc_processEXTENT(crc_State *state, const EXTENT *val); void crc_processEXTENT(crc_State *state, const EXTENT *val);
void crc_processVELOCITY_DESC(crc_State *state, const VELOCITY_DESC *val); void crc_processVELOCITY_DESC(crc_State *state, const VELOCITY_DESC *val);
#if 0
void crc_processPOINT(crc_State *state, const POINT *val); void crc_processPOINT(crc_State *state, const POINT *val);
#if 0
void crc_processSTAMP(crc_State *state, const STAMP *val); void crc_processSTAMP(crc_State *state, const STAMP *val);
void crc_processINTERSECT_CONTROL(crc_State *state, void crc_processINTERSECT_CONTROL(crc_State *state,
const INTERSECT_CONTROL *val); const INTERSECT_CONTROL *val);
#endif #endif
void crc_processSTATE(crc_State *state, const STATE *val);
void crc_processELEMENT(crc_State *state, const ELEMENT *val); void crc_processELEMENT(crc_State *state, const ELEMENT *val);
void crc_processDispQueue(crc_State *state); void crc_processDispQueue(crc_State *state);
void crc_processRNG(crc_State *state);
void crc_processState(crc_State *state);
void initChecksumBuffers(void); void initChecksumBuffers(void);