本文整理汇总了C++中ReadWord函数的典型用法代码示例。如果您正苦于以下问题:C++ ReadWord函数的具体用法?C++ ReadWord怎么用?C++ ReadWord使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ReadWord函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: snes2pc
void MMXCore::LoadTilesAndPalettes()
{
// Load Palettes
DWORD configPointer = snes2pc(SReadWord(p_palett[type] + level*2 + 0x60) | 0x860000);
BYTE colorsToLoad = rom[configPointer++];
if (type==2)
pPalette = snes2pc(ReadWord(configPointer++) | 0x8C0000);
else
pPalette = snes2pc(ReadWord(configPointer++) | 0x850000);
for(int i=0; i<colorsToLoad; i++)
palCache[i] = Get16Color(pPalette + i*2);
for(int i=0; i<(colorsToLoad>>4); i++)
palettesOffset[i] = (DWORD)pPalette + i*0x20;
memcpy(vram, vrambase, 0x200);
if (type==0) // Only MMX1 is able to do this
{
LoadPaletteDynamic();
LoadGFXs();
LoadTiles();
}
for(int i=0; i<0x400; i++)
tile4bpp2raw(vram + (i<<5), vramCache + (i<<6));
}
示例2: ReadWord
void MMXCore::LoadPaletteDynamic()
{
WORD iLevel = level & 0xFF;
BYTE palSelect = checkpointInfo->palLoad;
int baseIndex = ReadWord(0x32260 + iLevel*2) + palSelect*2;
int mainIndex = ReadWord(0x32260 + baseIndex);
int writeTo = 0;
int colorPointer = 0;
while(true)
{
colorPointer = ReadWord(0x32260 + mainIndex);
if (colorPointer == 0xFFFF)
return;
writeTo = (ReadWord(0x32262 + mainIndex) & 0xFF);
if (writeTo > 0x7F)
{
MessageBox(NULL, "Palette overflow.", "Error", MB_ICONERROR);
return;
}
palettesOffset[writeTo>>4] = snes2pc(colorPointer | 0x850000);
for(int i=0; i<0x10; i++)
{
palCache[writeTo + i] = Convert16Color(ReadWord(snes2pc(0x850000 | colorPointer + i*2)));
}
mainIndex += 3;
}
}
示例3: MReadKbd
void MReadKbd()
{
int ccode,mod;
int kbrd_called=0;
while(qCharLen())
{
asciiChar=charAscii[charHead];
ccode=charBuff[charHead][1];
mod=charBuff[charHead++][0];
if (charHead>=CHAR_BUFF_LEN) charHead=0;
/*printf("char %c %d\t ccode %d\n",asciiChar,asciiChar,ccode);*/
reg[1]=ccode;
reg[2]=mod;
aReg[2]=ReadLong(0x2804c);
/* printf("calling subr %d\n",((w16)(uw16)ReadWord(0x150))+0x4000);*/
QLsubr(ReadWord(0x150)+0x4000,2000000);
/*printf("result: %d\n",reg[0]);*/
kbrd_called=1;
}
if (gKeyDown /*&& !MButtonDown /*|| kbrd_called */)
{
kbrd_called=0;
aReg[2]=ReadLong(0x2804c);
reg[5]=-1;/*(gKeyDown!=0)<<4;*/
QLsubr(ReadWord(0x152)+0x4000,2000000);
}
}
示例4: Stop
bool CBotProgram::RestoreState(FILE* pf)
{
unsigned short w;
std::string s;
Stop();
if (!ReadWord( pf, w )) return false;
if ( w != CBOTVERSION ) return false;
if (!ReadWord( pf, w )) return false;
if ( w == 0 ) return true;
if (!ReadString( pf, s )) return false;
Start(s); // point de reprise
if (m_stack != nullptr)
{
m_stack->Delete();
m_stack = nullptr;
}
// retrieves the stack from the memory
m_stack = CBotStack::AllocateStack();
if (!m_stack->RestoreState(pf, m_stack)) return false;
m_stack->SetProgram(this); // bases for routines
// restored some states in the stack according to the structure
m_entryPoint->RestoreState(nullptr, m_stack, m_thisVar);
return true;
}
示例5: Read
void CPipeServer::FindClass()
{
void *image=(void *)ReadQword();
WORD length=ReadWord();
char *cn=NULL;
char *ns=NULL;
void *klass;
cn=(char *)malloc(length+1);
if (length)
Read(cn, length);
cn[length]=0;
length=ReadWord();
ns=(char *)malloc(length+1);
if (length)
Read(ns, length);
ns[length]=0;
klass=mono_class_from_name_case(image, ns, cn);
if (cn)
free(cn);
if (ns)
free(ns);
WriteQword((UINT_PTR)klass);
}
示例6: ReadByte
//
// ReadStartOfFrame()
//
void JLSInputStream::ReadStartOfFrame()
{
_info.bitspersample = ReadByte();
int cline = ReadWord();
int ccol = ReadWord();
_info.width = ccol;
_info.height = cline;
_info.components= ReadByte();
}
示例7: SkipWhite
int VICARKeywordHandler::ReadPair( CPLString &osName, CPLString &osValue ) {
osName = "";
osValue = "";
if( !ReadWord( osName ) ) {
return FALSE;}
SkipWhite();
// VICAR has no NULL string termination
if( *pszHeaderNext == '\0') {
osName="END";
return TRUE;
}
pszHeaderNext++;
SkipWhite();
osValue = "";
if( *pszHeaderNext == '(' && pszHeaderNext[1] == '\'' )
{
CPLString osWord;
while( ReadWord( osWord ) )
{
osValue += osWord;
if ( strlen(osWord) < 2 ) continue;
if( osWord[strlen(osWord)-1] == ')' && osWord[strlen(osWord)-2] == '\'' ) break;
}
}
else if( *pszHeaderNext == '(' && *pszHeaderNext-1 != '\'' )
{
CPLString osWord;
while( ReadWord( osWord ) )
{
SkipWhite();
osValue += osWord;
if( osWord[strlen(osWord)-1] == ')' ) break;
}
}
else
{
if( !ReadWord( osValue ) ) return FALSE;
}
SkipWhite();
return TRUE;
}
示例8: ScanModPublics
int ScanModPublics(WORD wModule){
BYTE abBuffer[300];
WORD wLen,wPublics;
BYTE *pbBuffer,bType;
wPublics=0;
_tlseek(wLib,alOffsets[wModule],0);
if (ReadByte()== THEADR)
if (ReadHdrRecord(abBuffer)){
while(TRUE){
bType = ReadByte();
switch(bType){
case PUBDEF:
if ((wLen = ReadWord())!=0xffff){
WORD GrpIndex,SegIndex;
if ((GrpIndex=ReadByte()) >= 128){
wLen -=2;
ReadByte();
} else wLen--;
if ((SegIndex=ReadByte()) >= 128){
wLen -=2;
ReadByte();
} else wLen--;
if (GrpIndex==0 && SegIndex == 0){
ReadWord();
wLen -= 2;
}
while(wLen > 1){
ReadName(abBuffer);
pcStrings[wPublics]=_xgrab(strlen(abBuffer)+1);
strcpy(pcStrings[wPublics],abBuffer);
wPublics++;
ReadWord();
if (ReadByte() >= 128){
wLen -=2;
ReadByte();
} else wLen--;
wLen -= strlen(abBuffer)+1;
wLen -= 2;
}
ReadByte();
}
break;
case 0x0:
case LIBTRL:
case THEADR:
return wPublics;
default:
if (!SkipRecord()){
return 0xffff;
}
}
}
}
FreeStrings(wPublics);
return 0xffff;
}
示例9: i80286_data_descriptor_full
static void i80286_data_descriptor_full(i80286_state *cpustate, int reg, UINT16 selector, int cpl, UINT32 trap, UINT16 offset, int size)
{
if (PM) {
UINT16 desc[3];
UINT8 r;
UINT32 addr;
/* selector format
15..3 number/address in descriptor table
2: 0 global, 1 local descriptor table
1,0: requested privileg level
must be higher or same as current privileg level in code selector */
if ((reg != SS) && !IDXTBL(selector)) {
cpustate->sregs[reg]=0;
cpustate->limit[reg]=0;
cpustate->base[reg]=0;
cpustate->rights[reg]=0;
cpustate->valid[reg]=0;
return;
}
if ((addr = i80286_selector_address(cpustate,selector)) == -1) throw trap;
desc[0] = ReadWord(addr);
desc[1] = ReadWord(addr+2);
desc[2] = ReadWord(addr+4);
r = RIGHTS(desc);
if (!SEGDESC(r)) throw trap;
if (reg == SS) {
if (!IDXTBL(selector)) throw trap;
if (DPL(r)!=cpl) throw trap;
if (RPL(selector)!=cpl) throw trap;
if (!RW(r) || CODE(r)) throw trap;
if (!PRES(r)) throw TRAP(STACK_FAULT,(IDXTBL(selector)+(trap&1)));
} else {
if ((DPL(r) < PMAX(cpl,RPL(selector))) && (!CODE(r) || (CODE(r) && !CONF(r)))) throw trap;
if (CODE(r) && !READ(r)) throw trap;
if (!PRES(r)) throw TRAP(SEG_NOT_PRESENT,(IDXTBL(selector)+(trap&1)));
}
if (offset+size) {
if ((CODE(r) || !EXPDOWN(r)) && ((offset+size-1) > LIMIT(desc))) throw (reg==SS)?TRAP(STACK_FAULT,(trap&1)):trap;
if (!CODE(r) && EXPDOWN(r) && ((offset <= LIMIT(desc)) || ((offset+size-1) > 0xffff))) throw (reg==SS)?TRAP(STACK_FAULT,(trap&1)):trap;
}
SET_ACC(desc);
WriteWord(addr+4, desc[2]);
cpustate->sregs[reg]=selector;
cpustate->limit[reg]=LIMIT(desc);
cpustate->base[reg]=BASE(desc);
cpustate->rights[reg]=RIGHTS(desc);
} else {
cpustate->sregs[reg]=selector;
cpustate->base[reg]=selector<<4;
}
cpustate->valid[reg]=1;
}
示例10: ReadWord
void FileManager_Model::LoadObj_AddPolygon(string line)
{
int val[3];
string position = line+2;
byte wordBuffer[MAX_FILE_WORD_LENGTH];
ReadWord(&position, wordBuffer);
val[0] = atoi(wordBuffer) + vertexOffset;
ReadWord(&position, wordBuffer);
val[1] = atoi(wordBuffer) + vertexOffset;
ReadWord(&position, wordBuffer);
val[2] = atoi(wordBuffer) + vertexOffset;
scene->addPolygon(val);
}
示例11: ReadWord
void XMLReader::Read() {
ReadWord();
if(strncmp(paraula,"<expressions>",11)==0)
{
// Elimina les expressions antigues i carrega el nou XML
int expressions = EManager->getNumExpressions();
for (int i=0; i<expressions; ++i)
{
EManager->resetExpression((TypeExpression) i);
}
ReadExpressions();
}
else if(strncmp(paraula,"<muscles>",9)==0)
{
// Elimina els muscles antics i carrega el nou XML
int muscles = MManager->getNumMuscles();
for (int i=0; i<muscles;++i)
{
MManager->ClearMuscle((TypeMuscle) i);
}
EditorM->ClearVertexs();
ReadMuscles();
}
fclose(fitxer);
}
示例12: main
int main()
{
struct avl_table *avltree;
struct bst_table *bsttree;
struct rb_table *rbtree;
avltree = avl_create(Compare_by_lexicographical_order, NULL, NULL);
bsttree = bst_create(Compare_by_lexicographical_order, NULL, NULL);
rbtree = rb_create(Compare_by_lexicographical_order, NULL, NULL);
for (int i = 0; i < 32; i++)
{
struct word *element =
(struct word *)malloc(sizeof(struct word));
ReadWord(element);
#ifdef DEBUG
printf("Read in word: %s, length = %d\n", element->s, element->length);
#endif
avl_probe(avltree, element);
bst_probe(bsttree, element);
rb_probe(rbtree, element);
}
preorder_avl(avltree->avl_root); puts("");
preorder_bst(bsttree->bst_root); puts("");
preorder_rb(rbtree->rb_root); puts("");
return 0;
}
示例13: MEndRep
void MEndRep()
{
aReg[2]=ReadLong(0x2804c);
reg[5]=0;/*(gKeyDown!=0)<<4;*/
QLsubr(ReadWord(0x152)+0x4000,2000000);
}
示例14: ReadString
// ------------------------------------------------------------------------------------------------
unsigned int ReadString(const char*& sbegin_out, const char*& send_out, const char* input,
const char*& cursor, const char* end, bool long_length = false, bool allow_null = false) {
const uint32_t len_len = long_length ? 4 : 1;
if(Offset(cursor, end) < len_len) {
TokenizeError("cannot ReadString, out of bounds reading length",input, cursor);
}
const uint32_t length = long_length ? ReadWord(input, cursor, end) : ReadByte(input, cursor, end);
if (Offset(cursor, end) < length) {
TokenizeError("cannot ReadString, length is out of bounds",input, cursor);
}
sbegin_out = cursor;
cursor += length;
send_out = cursor;
if(!allow_null) {
for (unsigned int i = 0; i < length; ++i) {
if(sbegin_out[i] == '\0') {
TokenizeError("failed ReadString, unexpected NUL character in string",input, cursor);
}
}
}
return length;
}
示例15: LearnVocabFromTrainFile
void LearnVocabFromTrainFile() {
char word[MAX_STRING];
FILE *fin;
long long a, i;
for (a = 0; a < vocab_hash_size; a++) vocab_hash[a] = -1;
fin = fopen(train_file, "rb");
if (fin == NULL) {
printf("ERROR: training data file not found!\n");
exit(1);
}
vocab_size = 0;
AddWordToVocab((char *)"</s>");
while (1) {
ReadWord(word, fin);
if (feof(fin)) break;
train_words++;
if ((debug_mode > 1) && (train_words % 100000 == 0)) {
fprintf(stderr, "%lldK%c", train_words / 1000, 13);
}
i = SearchVocab(word);
if (i == -1) {
a = AddWordToVocab(word);
vocab[a].cn = 1;
} else vocab[i].cn++;
if (vocab_size > vocab_hash_size * 0.7) ReduceVocab();
}
SortVocab();
if (debug_mode > 0) {
fprintf(stderr, "Vocab size: %lld\n", vocab_size);
fprintf(stderr, "Words in train file: %lld\n", train_words);
}
file_size = ftell(fin);
fclose(fin);
}