void PrintStringAndHex(tString * const pString,unsigned int Value) { WriteTxBuffer(pString); IntToHexString(Value,ConversionString); WriteTxBuffer(ConversionString); WriteTxBuffer("\r\n"); }
std::string IntToHexString(Platform::dword value, bool add0xPrefix, int minAddBytes) { char buff[CDwordBufferSizeBase16 + 3]; // + prefix and \0 ESS_ASSERT(IntToHexString(value, buff, sizeof(buff), add0xPrefix, minAddBytes)); return std::string(buff); }
void PrintTimeStamp(void) { GIE_CHECK(); GET_MUTEX(); IntToHexString(RTCPS,ConversionString); WriteTxBuffer(ConversionString); WriteTxBuffer(SPACE); GIVE_MUTEX(); }
void PrintStringAndHex(tString * const pString,unsigned int Value) { GIE_CHECK(); GET_MUTEX(); WriteTxBuffer(pString); IntToHexString(Value,ConversionString); WriteTxBuffer(ConversionString); WriteTxBuffer(CR); GIVE_MUTEX(); }
void DumpToHexString(const void *pData, size_t size, std::string &outStr) { ESS_ASSERT(pData != 0); outStr.clear(); if (size == 0) return; std::string sep(" "); int useBytes = 1; const Platform::byte *pBytes = static_cast<const Platform::byte*>(pData); for (int i = 0; i < size; ++i) { outStr += IntToHexString(*pBytes++, false, useBytes); if (i != (size - 1)) outStr += sep; } }
void XMLTestStarted(const char *testName, const char *suiteName, const char *testDescription, Uint64 execKey, time_t startTime) { char * output = XMLOpenElement(testElementName); XMLOutputter(indentLevel++, YES, output); // log test name output = XMLOpenElement(nameElementName); XMLOutputter(indentLevel++, NO, output); output = XMLAddContent(testName); XMLOutputter(indentLevel, NO, output); output = XMLCloseElement(nameElementName); XMLOutputter(--indentLevel, YES, output); // log test description output = XMLOpenElement(descriptionElementName); XMLOutputter(indentLevel++, NO, output); output = XMLAddContent(testDescription); XMLOutputter(indentLevel, NO, output); output = XMLCloseElement(descriptionElementName); XMLOutputter(--indentLevel, YES, output); // log execution key output = XMLOpenElement(execKeyElementName); XMLOutputter(indentLevel++, NO, output); output = XMLAddContent(IntToHexString(execKey)); XMLOutputter(indentLevel, NO, output); output = XMLCloseElement(execKeyElementName); XMLOutputter(--indentLevel, YES, output); // log start time output = XMLOpenElement(startTimeElementName); XMLOutputter(indentLevel++, NO, output); output = XMLAddContent(TimestampToString(startTime)); XMLOutputter(indentLevel, NO, output); output = XMLCloseElement(startTimeElementName); XMLOutputter(--indentLevel, YES, output); }
void PrintTimeStamp(void) { IntToHexString(RTCPS,ConversionString); WriteTxBuffer(ConversionString); WriteTxBuffer(" "); }
void UI_DisplayMessage(AActor* oTarget, int32 nMessage, FString sParam, int32 nColor) { /* FLOATY_HIT - Rising white number FLOATY_CRITICAL_HIT - Rising white number that grows and turns red FLOATY_MESSAGE - Yellow text (for debugging) */ if (GetM2DAInt(TABLE_UI_MESSAGES, "bDisabled", nMessage)) { #ifdef DEBUG Log_Trace(LOG_CHANNEL_UIMESSAGES, "UI_DisplayMessage " + IntToString(nMessage), "Not showing message " + IntToString(nMessage) + " - bDisabled set.", oTarget); #endif return; } int32 bShow = UI_CheckObjectMask(nMessage, oTarget); if (!bShow) { #ifdef DEBUG Log_Trace(LOG_CHANNEL_UIMESSAGES, "UI_DisplayMessage " + IntToString(nMessage), "Not showing message " + IntToString(nMessage) + " - Object Mask Failed", oTarget); #endif } bShow = bShow && UI_CheckDisplayMask(nMessage, oTarget) && UI_CheckObjectMask(nMessage, oTarget); if (bShow) { int32 nId = GetM2DAInt(TABLE_UI_MESSAGES, "StringId", nMessage); FString sMessage; int32 nType = GetM2DAInt(TABLE_UI_MESSAGES, "Type", nMessage); float fDuration = GetM2DAFloat(TABLE_UI_MESSAGES, "Duration", nMessage); if (fDuration <= 0.2f) { fDuration = UI_DISPLAY_DURATION_DEFAULT; } if (nType == 2 /*debug*/ && !GetDebugHelpersEnabled()) { #ifdef DEBUG Log_Trace(LOG_CHANNEL_UIMESSAGES, "UI_DisplayMessage " + IntToString(nMessage), "Not showing type 2 (debug) message " + IntToString(nMessage) + " - Debug Helpers disabled", oTarget); #endif return; } // ----------------------------------------------------------------- // special messages are defined in the scripted param to this function // ----------------------------------------------------------------- if (nMessage >= UI_MESSAGE_TYPE_SPECIAL) { sMessage = sParam; } else { if (nType == 2 && !LOG_ENABLED) { #ifdef DEBUG Log_Trace(LOG_CHANNEL_UIMESSAGES, "UI_DisplayMessage " + IntToString(nMessage), "Not showing message " + IntToString(nMessage) + " - Debug Type 2 but not log enabled.", oTarget); #endif return; } if (nId == 0) { sMessage = "?" + GetM2DAString(TABLE_UI_MESSAGES, "StringText", nMessage); } else { sMessage = GetStringByStringId(nId); if (sMessage == "") { #ifdef DEBUG LogWarning("String table lookup on UI message failed. Blocking bug to georg. Details:" + IntToString(nMessage) + " strid:" + IntToString(nId)); #endif } } } if (GetObjectType(oTarget) == OBJECT_TYPE_CREATURE) { if (GetStealthEnabled(oTarget) && !IsPartyMember(oTarget)) { #ifdef DEBUG Log_Trace(LOG_CHANNEL_UIMESSAGES, "UI_DisplayMessage", "Not showing message: creature stealthy", oTarget); #endif return; } } if (nColor == 0) { nColor = GetM2DAInt(TABLE_UI_MESSAGES, "Color", nMessage); } #ifdef DEBUG Log_Trace(LOG_CHANNEL_UIMESSAGES, "UI_DisplayMessage " + IntToString(nMessage) + " " + IntToHexString(nColor), sMessage, oTarget); #endif if (nType == UI_MESSAGE_TYPE_PORTRAIT) { DisplayPortraitMessage(oTarget, sMessage, nColor); } else if (nType == UI_MESSAGE_TYPE_PORTRAIT_FOLLOWER) { if (IsFollower(oTarget)) { DisplayPortraitMessage(oTarget, sMessage, nColor); } else { DisplayFloatyMessage(oTarget, sMessage, FLOATY_MESSAGE, nColor, fDuration); } } else { if (nMessage == UI_MESSAGE_MISSED || nMessage == UI_MESSAGE_IMMUNE) { DisplayFloatyMessage(oTarget, sMessage, FLOATY_HIT, nColor, fDuration); } else { DisplayFloatyMessage(oTarget, sMessage, FLOATY_MESSAGE, nColor, fDuration); } } } else { #ifdef DEBUG Log_Trace(LOG_CHANNEL_UIMESSAGES, "UI_DisplayMessage", "not showing " + IntToString(nMessage), oTarget); #endif } }
void WritePlugin(YAML::Emitter& out, const Plugin& plugin, const Game& game) { out << YAML::BeginMap; out << YAML::Key << "name" << YAML::Value << plugin.Name(); out << YAML::Key << "isActive"; if (game.IsActive(plugin.Name())) out << YAML::Value << true; else out << YAML::Value << false; if (plugin.Crc() != 0) { out << YAML::Key << "crc" << YAML::Value << IntToHexString(plugin.Crc()); } if (!plugin.Version().empty()) { out << YAML::Key << "version" << YAML::Value << boost::locale::translate("Version").str() + ": " + plugin.Version(); } std::set<Tag> tags = plugin.Tags(); std::set<Tag> tagsAdd, tagsRemove; if (!tags.empty()) { for (std::set<Tag>::const_iterator it = tags.begin(), endit = tags.end(); it != endit; ++it) { if (it->IsAddition()) tagsAdd.insert(*it); else tagsRemove.insert(*it); } if (!tagsAdd.empty()) { out << YAML::Key << "tagsAdd" << YAML::Value << tagsAdd; } if (!tagsRemove.empty()) { out << YAML::Key << "tagsRemove" << YAML::Value << tagsRemove; } } std::list<Message> messages = plugin.Messages(); std::set<PluginDirtyInfo> dirtyInfo = plugin.DirtyInfo(); for (std::set<PluginDirtyInfo>::const_iterator it = dirtyInfo.begin(), endit = dirtyInfo.end(); it != endit; ++it) { boost::format f; if (it->ITMs() > 0 && it->UDRs() > 0 && it->DeletedNavmeshes() > 0) f = boost::format(boost::locale::translate("Contains %1% ITM records, %2% UDR records and %3% deleted navmeshes. Clean with %4%.")) % it->ITMs() % it->UDRs() % it->DeletedNavmeshes() % it->CleaningUtility(); else if (it->ITMs() == 0 && it->UDRs() == 0 && it->DeletedNavmeshes() == 0) f = boost::format(boost::locale::translate("Clean with %1%.")) % it->CleaningUtility(); else if (it->ITMs() == 0 && it->UDRs() > 0 && it->DeletedNavmeshes() > 0) f = boost::format(boost::locale::translate("Contains %1% UDR records and %2% deleted navmeshes. Clean with %3%.")) % it->UDRs() % it->DeletedNavmeshes() % it->CleaningUtility(); else if (it->ITMs() == 0 && it->UDRs() == 0 && it->DeletedNavmeshes() > 0) f = boost::format(boost::locale::translate("Contains %1% deleted navmeshes. Clean with %2%.")) % it->DeletedNavmeshes() % it->CleaningUtility(); else if (it->ITMs() == 0 && it->UDRs() > 0 && it->DeletedNavmeshes() == 0) f = boost::format(boost::locale::translate("Contains %1% UDR records. Clean with %2%.")) % it->UDRs() % it->CleaningUtility(); else if (it->ITMs() > 0 && it->UDRs() == 0 && it->DeletedNavmeshes() > 0) f = boost::format(boost::locale::translate("Contains %1% ITM records and %2% deleted navmeshes. Clean with %3%.")) % it->ITMs() % it->DeletedNavmeshes() % it->CleaningUtility(); else if (it->ITMs() > 0 && it->UDRs() == 0 && it->DeletedNavmeshes() == 0) f = boost::format(boost::locale::translate("Contains %1% ITM records. Clean with %2%.")) % it->ITMs() % it->CleaningUtility(); else if (it->ITMs() > 0 && it->UDRs() > 0 && it->DeletedNavmeshes() == 0) f = boost::format(boost::locale::translate("Contains %1% ITM records and %2% UDR records. Clean with %3%.")) % it->ITMs() % it->UDRs() % it->CleaningUtility(); messages.push_back(loot::Message(loot::Message::warn, f.str())); } if (!messages.empty()) { out << YAML::Key << "messages" << YAML::Value << YAML::BeginSeq; for (std::list<Message>::const_iterator it = messages.begin(), endit = messages.end(); it != endit; ++it) { WriteMessage(out, *it); } out << YAML::EndSeq; } out << YAML::EndMap; }