std::vector<SymbolEntry> SymbolMap::GetAllSymbols(SymbolType symmask) { std::vector<SymbolEntry> result; if (symmask & ST_FUNCTION) { lock_guard guard(lock_); for (auto it = activeFunctions.begin(); it != activeFunctions.end(); it++) { SymbolEntry entry; entry.address = it->first; entry.size = GetFunctionSize(entry.address); const char* name = GetLabelName(entry.address); if (name != NULL) entry.name = name; result.push_back(entry); } } if (symmask & ST_DATA) { lock_guard guard(lock_); for (auto it = activeData.begin(); it != activeData.end(); it++) { SymbolEntry entry; entry.address = it->first; entry.size = GetDataSize(entry.address); const char* name = GetLabelName(entry.address); if (name != NULL) entry.name = name; result.push_back(entry); } } return result; }
void SymbolMap::FillSymbolListBox(HWND listbox,SymbolType symType) { if (activeNeedUpdate_) UpdateActiveSymbols(); wchar_t temp[256]; std::lock_guard<std::recursive_mutex> guard(lock_); SendMessage(listbox, WM_SETREDRAW, FALSE, 0); ListBox_ResetContent(listbox); switch (symType) { case ST_FUNCTION: { SendMessage(listbox, LB_INITSTORAGE, (WPARAM)activeFunctions.size(), (LPARAM)activeFunctions.size() * 30); for (auto it = activeFunctions.begin(), end = activeFunctions.end(); it != end; ++it) { const FunctionEntry& entry = it->second; const char* name = GetLabelName(it->first); if (name != NULL) wsprintf(temp, L"%S", name); else wsprintf(temp, L"0x%08X", it->first); int index = ListBox_AddString(listbox,temp); ListBox_SetItemData(listbox,index,it->first); } } break; case ST_DATA: { int count = ARRAYSIZE(defaultSymbols)+(int)activeData.size(); SendMessage(listbox, LB_INITSTORAGE, (WPARAM)count, (LPARAM)count * 30); for (int i = 0; i < ARRAYSIZE(defaultSymbols); i++) { wsprintf(temp, L"0x%08X (%S)", defaultSymbols[i].address, defaultSymbols[i].name); int index = ListBox_AddString(listbox,temp); ListBox_SetItemData(listbox,index,defaultSymbols[i].address); } for (auto it = activeData.begin(), end = activeData.end(); it != end; ++it) { const DataEntry& entry = it->second; const char* name = GetLabelName(it->first); if (name != NULL) wsprintf(temp, L"%S", name); else wsprintf(temp, L"0x%08X", it->first); int index = ListBox_AddString(listbox,temp); ListBox_SetItemData(listbox,index,it->first); } } break; } SendMessage(listbox, WM_SETREDRAW, TRUE, 0); RedrawWindow(listbox, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN); }
std::string SymbolMap::GetLabelString(u32 address) const { lock_guard guard(lock_); const char *label = GetLabelName(address); if (label == NULL) return ""; return label; }
void ForwardLabel (unsigned Offs) /* If necessary, output a forward label, one that is within the next few * bytes and is therefore output as "label = * + x". */ { /* Calculate the actual address */ unsigned long Addr = PC + Offs; /* Get the type of the label */ attr_t A = GetLabelAttr (Addr); /* If there is no label, or just a dependent one, bail out */ if (A == atNoLabel || (A & atDepLabel) != 0) { return; } /* An unnamed label cannot be output as a forward declaration, so this is * an error. */ if (A == atUnnamedLabel) { Error ("Cannot define unnamed label at address $%04lX", Addr); } /* Output the label */ DefForward (GetLabelName (Addr), GetComment (Addr), Offs); }
static void GenerateLabel (unsigned Flags, unsigned Addr) /* Generate a label in pass one if requested */ { /* Generate labels in pass #1, and only if we don't have a label already */ if (Pass == 1 && !HaveLabel (Addr) && /* Check if we must create a label */ ((Flags & flGenLabel) != 0 || ((Flags & flUseLabel) != 0 && Addr >= CodeStart && Addr <= CodeEnd))) { /* As a special case, handle ranges with tables or similar. Within * such a range with a granularity > 1, do only generate dependent * labels for all addresses but the first one. Be sure to generate * a label for the start of the range, however. */ attr_t Style = GetStyleAttr (Addr); unsigned Granularity = GetGranularity (Style); if (Granularity == 1) { /* Just add the label */ AddIntLabel (Addr); } else { /* THIS CODE IS A MESS AND WILL FAIL ON SEVERAL CONDITIONS! ### */ /* Search for the start of the range or the last non dependent * label in the range. */ unsigned Offs; attr_t LabelAttr; unsigned LabelAddr = Addr; while (LabelAddr > CodeStart) { if (Style != GetStyleAttr (LabelAddr-1)) { /* End of range reached */ break; } --LabelAddr; LabelAttr = GetLabelAttr (LabelAddr); if ((LabelAttr & (atIntLabel|atExtLabel)) != 0) { /* The address has an internal or external label */ break; } } /* If the proposed label address doesn't have a label, define one */ if ((GetLabelAttr (LabelAddr) & (atIntLabel|atExtLabel)) == 0) { AddIntLabel (LabelAddr); } /* Create the label */ Offs = Addr - LabelAddr; if (Offs == 0) { AddIntLabel (Addr); } else { AddDepLabel (Addr, atIntLabel, GetLabelName (LabelAddr), Offs); } } } }
std::string SymbolMap::GetLabelString(u32 address) { std::lock_guard<std::recursive_mutex> guard(lock_); const char *label = GetLabelName(address); if (label == NULL) return ""; return label; }
const char *SymbolMap::GetDescription(unsigned int address) const { const char* labelName = NULL; u32 funcStart = GetFunctionStart(address); if (funcStart != INVALID_ADDRESS) { labelName = GetLabelName(funcStart); } else { u32 dataStart = GetDataStart(address); if (dataStart != INVALID_ADDRESS) labelName = GetLabelName(dataStart); } if (labelName != NULL) return labelName; sprintf(descriptionTemp, "(%08x)", address); return descriptionTemp; }
void SymbolMap::SaveSymbolMap(const char *filename) const { lock_guard guard(lock_); FILE *f = File::OpenCFile(filename, "w"); if (!f) return; fprintf(f,".text\n"); for (auto it = functions.begin(), end = functions.end(); it != end; ++it) { const FunctionEntry& e = it->second; fprintf(f,"%08x %08x %08x %i %s\n",it->first,e.size,it->first,ST_FUNCTION,GetLabelName(it->first)); } for (auto it = data.begin(), end = data.end(); it != end; ++it) { const DataEntry& e = it->second; fprintf(f,"%08x %08x %08x %i %s\n",it->first,e.size,it->first,ST_DATA,GetLabelName(it->first)); } fclose(f); }
void SymbolMap::AddFunction(const char* name, u32 address, u32 size) { lock_guard guard(lock_); FunctionEntry func; func.size = size; func.index = (int)functions.size(); functions[address] = func; if (GetLabelName(address) == NULL) AddLabel(name,address); }
std::string SymbolMap::GetDescription(unsigned int address) { std::lock_guard<std::recursive_mutex> guard(lock_); const char* labelName = NULL; u32 funcStart = GetFunctionStart(address); if (funcStart != INVALID_ADDRESS) { labelName = GetLabelName(funcStart); } else { u32 dataStart = GetDataStart(address); if (dataStart != INVALID_ADDRESS) labelName = GetLabelName(dataStart); } if (labelName != NULL) return labelName; char descriptionTemp[256]; sprintf(descriptionTemp, "(%08x)", address); return descriptionTemp; }
MemoryType* CreateCodeMachine ( char** SourceCode, Label* LabelTable, Command* CommandsTable, uint32_t ProgramSize ) { ASSERT ( SourceCode ); ASSERT ( LabelTable ); ASSERT ( CommandsTable ); ASSERT ( ProgramSize ); MemoryType* MachineCode = ( MemoryType* ) calloc ( ProgramSize + SignatureSize, sizeof ( MemoryType ) ); ASSERT ( MachineCode ); MachineCode[0] = 'E'; MachineCode[1] = 'A'; MachineCode[2] = 'S'; MachineCode[3] = 'M'; MachineCode[4] = 'D'; MachineCode[5] = 'V'; MachineCode[6] = '1'; MachineCode[7] = '.'; MachineCode[8] = '1'; MachineCode[9] = ProgramSize; uint32_t ProgramCounter = SignatureSize - 1; uint32_t ProgramLine = 0; while ( SourceCode[ProgramLine] != NULL ) { uint32_t j = 0; uint8_t ComSize = 0; if ( GetLabelName ( SourceCode[ProgramLine] ) == NULL ) { while ( IsSpace ( *( SourceCode[ProgramLine] + j ) ) == OK ) j++; char Command[MaxLengthCommands] = {}; if ( sscanf ( SourceCode[ProgramLine] + j, "%[A-Z]", Command ) == 0 ) { ProgramLine++; continue; } MemoryType ReturnData = GetCommandCodeAndSize ( CommandsTable, Command, &ComSize ); ProgramCounter++; MachineCode[ProgramCounter] = ReturnData; while ( IsSpace ( *( SourceCode[ProgramLine] + j ) ) != OK && *( SourceCode[ProgramLine] + j ) != '\0' ) j++; } else { ProgramLine++; continue; } /**************************************************************************************************/ /**************************************************************************************************/ if ( ComSize != 1 && ( MachineCode[ProgramCounter] > JNZ || MachineCode[ProgramCounter] < CALL ) ) { uint32_t NumReg = GetFirstArg ( SourceCode[ProgramLine], &j, RegArg ); if ( NumReg == Error ) { printf ( " === Error first argument on line: %d ===", ProgramLine + 1 ); errno = EINVAL; return NULL; } else { ProgramCounter++; MachineCode[ProgramCounter] = NumReg; } if ( ComSize == 2 ) { ProgramLine++; continue; } } /**************************************************************************************************/ /**************************************************************************************************/ if ( ComSize == 3 ) { uint32_t StartPos = j; uint32_t SecArgReg = GetSecondArg ( SourceCode[ProgramLine], &j, RegArg ); j = StartPos; uint32_t SecArgNum = GetSecondArg ( SourceCode[ProgramLine], &j, NumArg ); if ( SecArgReg == Error && SecArgNum == Error && errno != 0 ) { printf ( " === Error second argument on line: %d ===", ProgramLine + 1 ); errno = EINVAL; return NULL; } else { if ( SecArgNum == Error && errno != 0 ) { ProgramCounter++; MachineCode[ProgramCounter] = SecArgReg; errno = 0; } if ( SecArgReg == Error ) { ProgramCounter++; MachineCode[ProgramCounter] = SecArgNum; MachineCode[ProgramCounter - 2]++; } } } /**************************************************************************************************/ /**************************************************************************************************/ if ( ComSize == 2 && MachineCode[ProgramCounter] <= JNZ && MachineCode[ProgramCounter] >= CALL ) { uint64_t LabelName = GetFirstArg ( SourceCode[ProgramLine], &j, LblArg ); if ( LabelName == Error ) { printf ( " === Error name of label on line: %d ===", ProgramLine + 1 ); errno = EINVAL; return NULL; } uint32_t AddressLabel = GetAddressLabel ( LabelTable, ( char* )LabelName ); if ( AddressLabel == Error ) { printf ( " === Not found label on line %d ===", ProgramLine + 1 ); errno = EINVAL; return NULL; } else { ProgramCounter++; MachineCode[ProgramCounter] = AddressLabel; } } ProgramLine++; } return MachineCode; }
Label* CreateAndFillLabelTable ( char** SourceCode, Command* CommandsTable, uint32_t* ProgramSize ) { ASSERT ( SourceCode ); ASSERT ( CommandsTable ); uint32_t NumberLabel = GetNumberLabel ( SourceCode ); Label* LabelTable = ( Label* ) calloc ( NumberLabel + 1, sizeof ( Label ) ); ASSERT ( LabelTable ); //==================== uint32_t i = 0; uint32_t LabelCounter = 0; while ( SourceCode[i] != NULL ) { char* NameLabel = GetLabelName ( SourceCode[i] ); //Mistake in name of label if ( NameLabel == ( char* )( NULL + 1 ) ) { printf( " === Invalid name of label on line %d ===", i + 1 ); errno = EINVAL; return NULL; } //It is right label if ( NameLabel != NULL ) { LabelTable[LabelCounter].NameLabel = NameLabel; LabelTable[LabelCounter].ProgramAddress = *ProgramSize; LabelCounter++; } //It is command or empty string else { uint32_t j = 0; char Command[MaxLengthCommands] = {}; while ( IsSpace ( *( SourceCode[i] + j ) ) == OK ) j++; if ( IsAlpha ( *( SourceCode[i] + j ) ) != OK ) { if ( *( SourceCode[i] + j ) == '\0' || *( SourceCode[i] + j ) == '\r' || *( SourceCode[i] + j ) == '\n' ) { i++; continue; } printf( " === Invalid command on line %d ===", i + 1 ); errno = EINVAL; return NULL; } if ( sscanf ( SourceCode[i] + j, "%[A-Z]", Command ) == 0 ) { printf( " === Invalid command on line %d ===", i + 1 ); errno = EINVAL; return NULL; } else { uint8_t ComSize = 0; if ( GetCommandCodeAndSize ( CommandsTable, Command, &ComSize ) == Error ) { printf( " === This command on line %d not found ===", i + 1 ); errno = EINVAL; return NULL; } *ProgramSize += ComSize; } } i++; } //*ProgramSize += SignatureSize; // Service information return LabelTable; }
void moNetOSCOut::SendDataMessage( int i, moDataMessage &datamessage ) { #ifdef OSCPACK if (packetStream==NULL) { cout << "moNetOSCOut::SendDataMessage > error: packetStream is NULL" << endl; return; } #endif //cout << "moNetOSCOut::SendDataMessage > start" << endl; #ifdef OSCPACK packetStream->Clear(); //cout << "moNetOSCOut::SendDataMessage > Clear() ok." << endl; (*packetStream) << osc::BeginBundleImmediate; //cout << "moNetOSCOut::SendDataMessage > BeginBundleImmediate ok." << endl; (*packetStream) << osc::BeginMessage( moText("")+ IntToStr(datamessage.Count()) ); //cout << "moNetOSCOut::SendDataMessage > data in messages:" << datamessage.Count() << endl; #else lo_timetag timetag; lo_timetag_now(&timetag); lo_bundle bundle = lo_bundle_new(timetag); lo_message ms = lo_message_new(); moText oscpath = ""; #endif moData data; int nfields = 0; int error = 0; try { for(int j=0; j< datamessage.Count(); j++) { data = datamessage[j]; if (debug_is_on) MODebug2->Message( moText("moNetOSCOut::SendDataMessage "+GetLabelName()+" > data:") + IntToStr(j) ); switch(data.Type()) { #ifdef OSCPACK case MO_DATA_NUMBER_FLOAT: (*packetStream) << data.Float(); break; case MO_DATA_NUMBER_INT: (*packetStream) << data.Int(); break; case MO_DATA_NUMBER_LONG: (*packetStream) << data.Long(); break; case MO_DATA_NUMBER_DOUBLE: (*packetStream) << data.Double(); break; case MO_DATA_TEXT: (*packetStream) << (char*)data.Text(); break; #else case MO_DATA_NUMBER_FLOAT: error = lo_message_add_float( ms , data.Float()); nfields++; break; case MO_DATA_NUMBER_INT: error = lo_message_add_int32( ms , data.Int()); nfields++; break; case MO_DATA_NUMBER_LONG: error = lo_message_add_int64( ms , data.Long()); nfields++; break; case MO_DATA_NUMBER_DOUBLE: error = lo_message_add_double( ms , data.Double()); nfields++; break; case MO_DATA_TEXT: if (oscpath=="") { oscpath = data.Text(); moText mot = data.Text().Left(50000); error = lo_message_add_string( ms , (char*)mot); nfields++; } else { moText mot = data.Text().Left(50000); error = lo_message_add_string( ms , (char*)mot); nfields++; } break; #endif } if (error<0) MODebug2->Error(moText("moNetOSCOut > data error adding value: ") + data.ToText() ); } #ifdef OSCPACK } catch(osc::Exception E) { MODebug2->Error( moText("moNetOSCOut > Exception: ") + E.what() + " packet actual size: (" + IntToStr( (*packetStream).Size() ) + ") " + " Data too long for buffer: (max OUTPUT_BUFFER_SIZE:" + IntToStr(OUTPUT_BUFFER_SIZE) + ") " + data.ToText() + " (size:"+ IntToStr(data.ToText().Length())+" )" + " (total size:" + IntToStr( data.ToText().Length() + (*packetStream).Size() ) + ")" ); } (*packetStream) << osc::EndMessage; //cout << "moNetOSCOut::SendDataMessage > osc::EndMessage ok" << endl; //cout << "osc::EndBundle: " << endl; //cout << osc::EndBundle << endl; #ifdef MO_WIN32 (*packetStream) << osc::EndBundle; #endif //cout << "moNetOSCOut::SendDataMessage > osc::EndBundle ok" << endl; //cout << "moNetOSCOut::SendDataMessage > sending." << endl; if (transmitSockets[i]) { //MODebug2->Message(moText("moNetOSCOut > sending ") + IntToStr(i) + " size:" + IntToStr(packetStream->Size()) ); transmitSockets[i]->Send( packetStream->Data(), packetStream->Size() ); } #else } catch(...) {
void moNetOSCOut::Update(moEventList *Eventos) { MOuint i; bool res; moEvent *tmp; moEvent *actual; UpdateParameters(); // Sending over the network the events that correspond to recognized devices. //Eventos->Add( MO_IODEVICE_TRACKER, moGetTicks(), 112, 113, 114, 115 ); if (m_SendEvents) { actual = Eventos->First; while(actual != NULL) { if ( actual->deviceid==MO_IODEVICE_KEYBOARD ) { //if(recog_devices[actual->deviceid]) moDataMessage event_data_message; moData pData; pData.SetText( moText("EVENT") ); event_data_message.Add(pData); pData.SetInt( actual->deviceid ); event_data_message.Add(pData); pData.SetInt( actual->devicecode ); event_data_message.Add(pData); pData.SetInt( actual->reservedvalue0 ); event_data_message.Add(pData); pData.SetInt( actual->reservedvalue1 ); event_data_message.Add(pData); pData.SetInt( actual->reservedvalue2 ); event_data_message.Add(pData); pData.SetInt( actual->reservedvalue3 ); event_data_message.Add(pData); for (i = 0; i < (int)host_name.Count(); i++) { /* res = eventPacket[i]->AddEvent(actual); if (eventPacket[i]->ReadyToSend()) { SendEvent(i); eventPacket[i]->ClearPacket(); if (!res) eventPacket[i]->AddEvent(actual); } */ SendDataMessage( i, event_data_message ); } } if (delete_events) { tmp = actual->next; Eventos->Delete(actual); actual = tmp; } else actual = actual->next; } } if (m_sendMoldeoApi) { actual = Eventos->First; while(actual != NULL) { if ( actual->deviceid == MO_IODEVICE_CONSOLE && actual->devicecode == MO_ACTION_MOLDEOAPI_EVENT_SEND && actual->reservedvalue3 == MO_DATAMESSAGE && actual->pointer ) { /// moldeoapi_data_message if (debug_is_on) MODebug2->Message( moText("moNetOSCOut::Update "+GetLabelName()+" > Sending Moldeo API Message!") ); moDataMessage* MoldeoAPIMessage = (moDataMessage*)actual->pointer; for (i = 0; i < host_name.Count(); i++) { //res = eventPacket[i]->AddEvent(actual); //if (eventPacket[i]->ReadyToSend()) { if (debug_is_on) MODebug2->Message( moText("moNetOSCOut::Update "+GetLabelName()+" > SendDataMessage to host: I:") + (moText)IntToStr( i )+host_name[i] ); SendDataMessage( i, *MoldeoAPIMessage ); //eventPacket[i]->ClearPacket(); //if (!res) eventPacket[i]->AddEvent(actual); } } } actual = actual->next; } } /* */ //inlets outlets moMoldeoObject::Update(Eventos); int MsgToSend = GetInletIndex("DATAMESSAGE" ); if (MsgToSend > -1 && 1==1) { moInlet* pInlet = GetInlets()->Get(MsgToSend); if (pInlet ) { if (pInlet->Updated()) { moDataMessage data_message; moData mData; moData* pData = pInlet->GetData(); if (pData) { if (pData->Type()==MO_DATA_MESSAGE) { //if (debug_is_on) MODebug2->Message( + pData->ToText()); moDataMessage* pMess = pData->Message(); if (pMess) { //MODebug2->Push( moText(" text: ") + pData->ToText()); for(int k=0; k<pMess->Count(); k++ ) { mData = pMess->Get(k); data_message.Add(mData); //MODebug2->Push( moText(" text d: ") + mData.ToText()); } } //mData.SetText("test"); //data_message.Add(mData); //moDataMessage DM = *pData->Message(); for (i = 0; i < host_name.Count(); i++) { { //MODebug2->Push( moText("sending DATAMESSAGE: ") + ccc ); SendDataMessage( i, data_message ); } } } } //moDataMessage* pMoldeoDataMessage = (moDataMessage*)pInlet->GetData()->Message(); /* moText ccc; for( int c=0; c<DM.Count(); c++) { ccc = ccc + DM.Get(c).ToText(); }*/ /* if (pMoldeoDataMessage) { moDataMessage DM = (*pMoldeoDataMessage); for (i = 0; i < host_name.Count(); i++) { { //MODebug2->Push( moText("sending DATAMESSAGE: ") + ccc ); //SendDataMessage( i, DM ); } } } */ } } } MsgToSend = GetInletIndex("DATAMESSAGES" ); if (MsgToSend > -1 && 1==1) { //if (debug_is_on) MODebug2->Message( moText("moNetOscOut::Update > DATAMESSAGES inlet")); moInlet* pInlet = GetInlets()->Get(MsgToSend); if (pInlet ) { //if (debug_is_on) MODebug2->Message( moText("moNetOscOut::Update > pInlet")); if (pInlet->Updated()) { //if (debug_is_on) MODebug2->Message( moText("moNetOscOut::Update > pInlet updated!")); moData* pData = pInlet->GetData(); if (pData) { //if (debug_is_on) MODebug2->Message( moText("moNetOscOut::Update > pInlet updated pData:") + pData->TypeToText()); if (pData->Type()==MO_DATA_MESSAGES) { //if (debug_is_on) MODebug2->Message( moText("moNetOscOut::Update > Receiving DATAMESSAGES: ") + pData->ToText()); //if (debug_is_on) MODebug2->Message( moText("moNetOscOut::Update > Receiving DATAMESSAGES: ") ); moDataMessages* pMessX = pData->Messages(); if (pMessX) { for(int m=0; m<pMessX->Count(); m++ ) { const moDataMessage& pMess(pMessX->Get(m)); moDataMessage data_message; moData mData; //MODebug2->Push( moText(" text: ") + pData->ToText()); for(int k=0; k<pMess.Count(); k++ ) { mData = pMess.Get(k); data_message.Add(mData); if (debug_is_on) MODebug2->Message( moText("moNetOscOut::Update "+GetLabelName()+" > Receiving DATAMESSAGES Message") + IntToStr(m)+ moText(" Data: ") +IntToStr(k) + " Val: " + mData.ToText()); } for (i = 0; i < host_name.Count(); i++) { { //if (debug_is_on) MODebug2->Message( moText("moNetOscOut::Update > sending DATAMESSAGE: ") ); SendDataMessage( i, data_message ); } } } } } } } } } moTrackerSystemData* m_pTrackerData = NULL; //bool m_bTrackerInit = false; //Procesar Inlets //MODebug2->Message("netoscout: updating"); /* for(int i=0; i<m_Inlets.Count(); i++) { moInlet* pInlet = m_Inlets[i]; if (pInlet->Updated() && ( pInlet->GetConnectorLabelName()==moText("TRACKERKLT")) ) { */ int Tracker = GetInletIndex("TRACKERKLT" ); if (Tracker > -1) { moInlet* pInlet = GetInlets()->Get(Tracker); if (pInlet ) { if (pInlet->Updated()) { //MODebug2->Message("netoscout: receiving tracker data"); m_pTrackerData = (moTrackerSystemData *)pInlet->GetData()->Pointer(); if (m_pTrackerData /*&& !m_bTrackerInit*/ ) { moDataMessage tracker_data_message; moData pData; /* pData.SetText( moText("speak") ); tracker_data_message.Add(pData); pData.SetText( moText("N") ); tracker_data_message.Add(pData); */ pData.SetInt( m_pTrackerData->GetValidFeatures() ); tracker_data_message.Add(pData); //if (m_pTrackerData->GetValidFeatures()>0 && m_pTrackerData->GetValidFeatures()<80) { pData.SetText( moText("MAX") ); tracker_data_message.Add(pData); pData.SetFloat( m_pTrackerData->GetMin().X() ); tracker_data_message.Add(pData); pData.SetFloat( m_pTrackerData->GetMin().Y() ); tracker_data_message.Add(pData); pData.SetFloat( m_pTrackerData->GetMax().X() ); tracker_data_message.Add(pData); pData.SetFloat( m_pTrackerData->GetMax().Y() ); tracker_data_message.Add(pData); pData.SetText( moText("BAR") ); tracker_data_message.Add(pData); pData.SetFloat( m_pTrackerData->GetBarycenter().X() ); tracker_data_message.Add(pData); pData.SetFloat( m_pTrackerData->GetBarycenter().Y() ); tracker_data_message.Add(pData); pData.SetText( moText("VAR") ); tracker_data_message.Add(pData); pData.SetFloat( m_pTrackerData->GetVariance().X() ); tracker_data_message.Add(pData); pData.SetFloat( m_pTrackerData->GetVariance().Y() ); tracker_data_message.Add(pData); pData.SetFloat( m_pTrackerData->GetVariance().Length() ); tracker_data_message.Add(pData); pData.SetText( moText("MP") ); tracker_data_message.Add(pData); for(i=0;i<m_pTrackerData->m_Zones;i++) { pData.SetInt( m_pTrackerData->GetPositionMatrix(m_pTrackerData->ZoneToPosition(i)) ); tracker_data_message.Add(pData); } pData.SetText( moText("MM") ); tracker_data_message.Add(pData); for(i=0;i<m_pTrackerData->m_Zones;i++) { pData.SetInt( m_pTrackerData->GetMotionMatrix(m_pTrackerData->ZoneToPosition(i)) ); tracker_data_message.Add(pData); } pData.SetText( moText("MA") ); tracker_data_message.Add(pData); for(i=0;i<m_pTrackerData->m_Zones;i++) { pData.SetInt( m_pTrackerData->GetAccelerationMatrix(m_pTrackerData->ZoneToPosition(i)) ); tracker_data_message.Add(pData); } pData.SetText( moText("VEL") ); tracker_data_message.Add(pData); pData.SetFloat( m_pTrackerData->GetBarycenterMotion().Length() ); tracker_data_message.Add(pData); pData.SetFloat( m_pTrackerData->GetBarycenterMotion().X() ); tracker_data_message.Add(pData); pData.SetFloat( m_pTrackerData->GetBarycenterMotion().Y() ); tracker_data_message.Add(pData); pData.SetText( moText("ACC") ); tracker_data_message.Add(pData); pData.SetFloat( m_pTrackerData->GetBarycenterAcceleration().Length() ); tracker_data_message.Add(pData); pData.SetFloat( m_pTrackerData->GetBarycenterAcceleration().X() ); tracker_data_message.Add(pData); pData.SetFloat( m_pTrackerData->GetBarycenterAcceleration().Y() ); tracker_data_message.Add(pData); //MODebug2->Message( moText("netoscout: receiving tracker data: bx:") + (moText)FloatToStr(m_pTrackerData->GetBarycenter().X()) ); //MODebug2->Push( moText("N:") + (moText)IntToStr( m_pTrackerData->GetValidFeatures() ) ); for (i = 0; i < host_name.Count(); i++) { //res = eventPacket[i]->AddEvent(actual); //if (eventPacket[i]->ReadyToSend()) { //MODebug2->Push( moText("sending I:") + (moText)IntToStr( i ) ); SendDataMessage( i, tracker_data_message ); //eventPacket[i]->ClearPacket(); //if (!res) eventPacket[i]->AddEvent(actual); } } // } } } } } }
LONG CED6AsDecompiler:: DumpInstrction( ED6_ACTION_SCRIPT_INFO *pAsInfo, ED6_AS_CRAFT_INFO *pCraft, ED6_INSTRUCTION *pInstruction, CFileDisk &file, LPSTR Buffer ) { LONG Status; CHAR szParamLengthTable[] = { 'b', 's', 't', 'i' }; ED6_INSTRUCTION_PARAM *pParam; ED6_AS_INSTRUCTION_MAP *pMap; ED6_INSTRUCTION_RECORD Ref; if (TEST_BITS(pInstruction->Flags, INSTRUCTION_FLAG_LINK)) { if (pInstruction != pCraft->pInstruction) WriteScr("\n"); return ASDECL_ERROR_DUMPED; } pMap = FindInstrctionMapByCode(pInstruction->Code); if (pMap == NULL) return ASDECL_ERROR_UNKNOWN_INSTRUCTION; pInstruction->Flags |= INSTRUCTION_FLAG_DUMPED; if (!TEST_BITS(pInstruction->Flags, INSTRUCTION_FLAG_UNLABEL)) { if (TEST_BITS(pInstruction->Flags, INSTRUCTION_FLAG_LABEL) || FindFunction(pInstruction->Offset, Ref)) { pInstruction->Flags |= INSTRUCTION_FLAG_UNLABEL; GetLabelName(pAsInfo, pInstruction->Offset, Buffer); // if (pInstruction != pCraft->pInstruction) WriteScr("\n"); WriteScr("#%s\n", Buffer); } } if (pInstruction->Code == AS_GOTO) { // if (IsLabelNextInstruction(pInstruction, pInstruction->Param->Value.LowPart)) // return ASDECL_ERROR_SUCCESS; } if (pMap->pszName != NULL) { WriteScr("%s", pMap->pszName); } else { WriteScr("%s%X", NAME_DEFAULT_INSTRUCTION_PREFIX, pMap->Instruction); } AS_IF_FAIL_RETURN(Status); if (pInstruction->ParamNumber == 0) { WriteScr("\n"); m_bLastIsNewLine = FALSE; return ASDECL_ERROR_SUCCESS; } WriteScr("("); pParam = pInstruction->Param; for (ULONG Count = 0; Count != pInstruction->ParamNumber; ++pParam, Count++) { LPSTR pszParamDesc = NULL; ED6_INSTRUCTION_PARAM_DESC *pDesc = NULL; if (Count != 0) { WriteScr(", "); } pDesc = pMap->pParamDesc; for (ULONG i = pMap->DescCount; i; ++pDesc, --i) { if (pDesc->pszDescription == NULL) continue; if (Count != pDesc->ParamIndex) continue; if (pDesc->Value != pParam->Value.LowPart) continue; pszParamDesc = pDesc->pszDescription; break; } if (pszParamDesc != NULL) { WriteScr("%s", pszParamDesc); if (pParam->Length != pDesc->Length) WriteScr(":%c", szParamLengthTable[pParam->Length - 1]); continue; } if (TEST_BITS(pParam->Flags, INSTRUCTION_FLAG_FLOAT)) { WriteScr("%f:f", pParam->Value.LowPart); continue; } if (!TEST_BITS(pParam->Flags, INSTRUCTION_PARAM_FLAG_ADDRESS)) { if (pParam->Length <= countof(szParamLengthTable)) { WriteScr("0x%X:%c", pParam->Value.LowPart, szParamLengthTable[pParam->Length - 1]); } else if (pParam->Length == INSTRUCTION_LENGTH_STRING) { WriteScr("\"%s\"", pParam->Value.LowPart ? (LPSTR)pParam->Value.LowPart : ""); } else { PBYTE pbParam = (PBYTE)&pParam->Value; WriteScr("[%02X", *pbParam++); for (ULONG Length = pParam->Length - 1; Length; --Length) WriteScr(" %02X", *pbParam++); WriteScr("]"); } } else { GetLabelName(pAsInfo, pParam->Value.LowPart, Buffer); WriteScr("%s:s", Buffer); } } WriteScr(")\n"); return Status; }