void ServerState_Init(ServerState *state, SessionRec *session, char *config) { register long a; register char *p; // clear every field of ServerState // for(p = (char *)state, a = 0; a < sizeof(ServerState); a++) *p++ = 0; state->validFlags = kServerValidFlag_None; state->session = session; if(session) state->validFlags |= kServerValidFlag_SessionRec; if(config) { state->validFlags |= kServerValidFlag_ConfigString; ByteCopy((Ptr)state->configBuffer, (Ptr)config, kConfigStrLength); } else state->configBuffer[0] = 0; state->account = NULL; state->personificationFlags = 0; state->personificationFlagsEditedByServer = 0; state->disallowGameConnect = false; }
BOOL operator = (UID &ud) { ByteCopy(uid, ud.GetBuffer(1), 64); SetLength(ud.GetSize()); return(TRUE); }
/** * * This bit of ugliness allows us to present a structure to the user. The * byte buffer which was read from the CompactFlash is converted into the * XSysAce_CFParameters structure. The byte buffer is accessed by the indices * of the fields as defined at the top of this file. We do not read from * CompactFlash directly into the CF Parameter structure because of structure * packing problems. * * Note that we also need to perform endian conversion here since the System * ACE device gives us little endian data and we're (possibly) on a big endian * processor. * * @param ParamPtr is the structure to fill * @param BufPtr is the byte buffer containing the CF parameter data * * @return * * None. * * @note * * None. * ******************************************************************************/ static void FillParam(XSysAce_CFParameters *ParamPtr, u8 *BufPtr) { u16 HiWord; u16 LoWord; XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_SIGNATURE]), &ParamPtr->Signature); XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_NUMCYLS]), &ParamPtr->NumCylinders); XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_RESERVED1]), &ParamPtr->Reserved); XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_NUMHEADS]), &ParamPtr->NumHeads); XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_BYTES_TRACK]), &ParamPtr->NumBytesPerTrack); XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_BYTES_SECT]), &ParamPtr->NumBytesPerSector); XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_SECTS_TRK]), &ParamPtr->NumSectorsPerTrack); /* NumSectorsPerCard is stored as two half-words, MSW first */ XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_SECTS_HI]), &HiWord); XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_SECTS_LO]), &LoWord); ParamPtr->NumSectorsPerCard = ((u32)HiWord << 16) | (u32)LoWord; XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_VENDOR1]), &ParamPtr->VendorUnique); ByteCopy(&BufPtr[XSA_CFPARM_SERIAL_NO], ParamPtr->SerialNo, 20); XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_BUFFER_TYPE]), &ParamPtr->BufferType); XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_BUFFER_SIZE]), &ParamPtr->BufferSize); XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_ECC_BYTES]), &ParamPtr->NumEccBytes); ByteCopy(&BufPtr[XSA_CFPARM_FW_VERSION], ParamPtr->FwVersion, 8); ByteCopy(&BufPtr[XSA_CFPARM_MODEL_NO], ParamPtr->ModelNo, 40); XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_MAX_SECTORS]), &ParamPtr->MaxSectors); XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_DBL_WORD]), &ParamPtr->DblWord); XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_CAPS]), &ParamPtr->Capabilities); XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_RESERVED2]), &ParamPtr->Reserved2); XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_PIO_MODE]), &ParamPtr->PioMode); XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_DMA_MODE]), &ParamPtr->DmaMode); XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_TRANSLATE]), &ParamPtr->TranslationValid); XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_CURCYLS]), &ParamPtr->CurNumCylinders); XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_CURHEADS]), &ParamPtr->CurNumHeads); XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_CURSECTS_TRK]), &ParamPtr->CurSectorsPerTrack); XIo_FromLittleEndian32(*((u32 *)&BufPtr[XSA_CFPARM_CURSECTS]), &ParamPtr->CurSectorsPerCard); XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_MULTIPLE]), &ParamPtr->MultipleSectors); XIo_FromLittleEndian32(*((u32 *)&BufPtr[XSA_CFPARM_LBA_SECTS]), &ParamPtr->LbaSectors); ByteCopy(&BufPtr[XSA_CFPARM_RESERVED3], ParamPtr->Reserved3, 132); XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_SECURITY]), &ParamPtr->SecurityStatus); ByteCopy(&BufPtr[XSA_CFPARM_VENDOR2], ParamPtr->VendorUniqueBytes, 62); XIo_FromLittleEndian16(*((u16 *)&BufPtr[XSA_CFPARM_POWER]), &ParamPtr->PowerDesc); ByteCopy(&BufPtr[XSA_CFPARM_RESERVED4], ParamPtr->Reserved4, 190); }