void HandleDXGIEvent(EVENT_RECORD* pEventRecord, PMTraceConsumer* pmConsumer) { enum { DXGIPresent_Start = 42, DXGIPresent_Stop, DXGIPresentMPO_Start = 55, DXGIPresentMPO_Stop = 56, }; auto const& hdr = pEventRecord->EventHeader; switch (hdr.EventDescriptor.Id) { case DXGIPresent_Start: case DXGIPresentMPO_Start: { PresentEvent event(hdr, Runtime::DXGI); GetEventData(pEventRecord, L"pIDXGISwapChain", &event.SwapChainAddress); GetEventData(pEventRecord, L"Flags", &event.PresentFlags); GetEventData(pEventRecord, L"SyncInterval", &event.SyncInterval); pmConsumer->RuntimePresentStart(event); break; } case DXGIPresent_Stop: case DXGIPresentMPO_Stop: { auto result = GetEventData<uint32_t>(pEventRecord, L"Result"); bool AllowBatching = SUCCEEDED(result) && result != DXGI_STATUS_OCCLUDED && result != DXGI_STATUS_MODE_CHANGE_IN_PROGRESS && result != DXGI_STATUS_NO_DESKTOP_ACCESS; pmConsumer->RuntimePresentStop(hdr, AllowBatching); break; } } }
void ProcCommand() { string comName = GetEventData(); string nodName = GetEventData(); switch(nodName) { case "B_OK": if(comName=="activate" || comName=="click") { ExecuteSailorPayment(); PostEvent("evntDoPostExit",1,"l",RC_INTERFACE_SALARY_EXIT); } break; case "B_CANCEL": if(comName=="activate" || comName=="click") { SkipSailorPayment(); PostEvent("evntDoPostExit",1,"l",RC_INTERFACE_SALARY_EXIT); } if(comName=="upstep") { if(GetSelectable("B_OK")) {SetCurrentNode("B_OK");} } break; } }
T GetEventData(EVENT_RECORD* pEventRecord, wchar_t const* name) { T value = {}; auto ok = GetEventData(pEventRecord, name, &value); (void) ok; return value; }
void EventList::AddGroup(const EventIndex& ev) { EventData data; GetEventData(ev, data); TCHAR eventText[256]; int i; eventText[0] = 0; tmi.printTimeStamp(NULL, data.timestamp, _T("d t"), eventText, 64, 0); std::wstring time = eventText; std::wstring user; if (data.isMe) user = myName; else user = contactName; GetEventMessage(ev, eventText, 256); for (i = 0; eventText[i] != 0 && eventText[i] != _T('\r') && eventText[i] != _T('\n'); ++i); eventText[i] = 0; if (i > Options::instance->groupMessageLen) { eventText[Options::instance->groupMessageLen - 3] = '.'; eventText[Options::instance->groupMessageLen - 2] = '.'; eventText[Options::instance->groupMessageLen - 1] = '.'; eventText[Options::instance->groupMessageLen] = 0; } int ico = 0; GetEventIcon(data.isMe, data.eventType, ico); AddGroup(data.isMe, time, user, eventText, ico); }
void WorldMap_Compas_ResetHelp() { string sectName = GetEventData(); if(sectName!="WorldMap_Compas_Clock") return; // Удалим с эрана все SetNewPicture("HELPPICTURE",""); SetFormatedText("TEXTWINDOW",""); }
void land_commands_ResetHelp() { string sectName = GetEventData(); if(sectName!="lands_commands") return; // Удалим с эрана все SetNewPicture("HELPPICTURE",""); SetFormatedText("TEXTWINDOW",""); }
void LAi_type_guardian_Return_Event() { aref chr = GetEventData(); if(!TestRef(chr)) return; chr.chr_ai.type.wait = ""; chr.chr_ai.type.enemy = ""; LAi_tmpl_runto_InitTemplate(chr); LAi_tmpl_runto_SetLocator(chr, chr.chr_ai.type.group, chr.chr_ai.type.locator, -1.0); }
void LAi_type_guardian_CmdAttack_Event() { aref chr = GetEventData(); if(!TestRef(chr)) return; chr.chr_ai.type.wait = ""; if(chr.chr_ai.type.enemy == "") return; int trg = sti(chr.chr_ai.type.enemy); LAi_type_guardian_CmdAttack_Now(chr, trg); }
void WorldMap_Compas_InitHelp() { string sectName = GetEventData(); if(sectName!="WorldMap_Compas") return; // Заполним экран содержимым // каринки SetNewPicture("HELPPICTURE","interfaces\helppictures\WM_Compas.tga"); // строки int strFileID = LanguageOpenFile("helpsections\WorldMap_Compas.txt"); SetFormatedText("TEXTWINDOW",LanguageConvertString(strFileID,"Compas_info")); GameInterface.strings.HelpName = LanguageConvertString(strFileID,"Compas_title"); LanguageCloseFile(strFileID); }
void ProcessControls() { string ControlName = GetEventData(); if( ControlName == "ILeft" && !bseg1 ) { UnloadSegment("test_seg2.c"); LoadSegment("test_seg1.c"); Event("ChangeSegment"); bseg1 = true; } if( ControlName == "IRight" && bseg1 ) { UnloadSegment("test_seg1.c"); LoadSegment("test_seg2.c"); Event("ChangeSegment"); bseg1 = false; } }
bool EventList::SearchInContact(MCONTACT hContact, TCHAR *strFind, ComparatorInterface* compFun) { InitFilters(); if (useImportedMessages) { std::vector<IImport::ExternalMessage> messages; { mir_cslock lck(csEventList); std::map<MCONTACT, EventList::ImportDiscData>::iterator it = contactFileMap.find(hContact); if (it != contactFileMap.end()) { ExportManager imp(hWnd, hContact, 1); imp.SetAutoImport(it->second.file); if (!imp.Import(it->second.type, messages, NULL)) messages.clear(); } } for (int i = 0; i < (int)importedMessages.size(); ++i) if (compFun->Compare((importedMessages[i].flags & DBEF_SENT) != 0, importedMessages[i].message, strFind)) return true; } std::list<EventTempIndex> tempList; GetTempList(tempList, false, true, hContact); EventIndex ei; EventData ed; TCHAR str[MAXSELECTSTR + 8]; // for safety reason for (std::list<EventTempIndex>::iterator itL = tempList.begin(); itL != tempList.end(); ++itL) { ei.isExternal = itL->isExternal; ei.hEvent = itL->hEvent; if (GetEventData(ei, ed)) { GetEventMessage(ei, str); if (compFun->Compare(ed.isMe, str, strFind)) return true; } } return false; }
void EventList::GetTempList(std::list<EventTempIndex>& tempList, bool noFilter, bool noExt, MCONTACT _hContact) { bool isWndLocal = isWnd; EventTempIndex ti; EventData data; EventIndex ei; ti.isExternal = false; ei.isExternal = false; MEVENT hDbEvent = db_event_first(_hContact); while (hDbEvent != NULL) { if (isWndLocal && !IsWindow(hWnd)) break; ei.hEvent = hDbEvent; if (GetEventData(ei, data)) { if (noFilter || CanShowHistory(&gdbei)) { ti.hEvent = hDbEvent; ti.timestamp = data.timestamp; tempList.push_back(ti); } } hDbEvent = db_event_next(_hContact, hDbEvent); } if (!noExt) { std::list<EventTempIndex>::iterator itL = tempList.begin(); ti.isExternal = true; for (int i = 0; i < (int)importedMessages.size(); ++i) { if (noFilter || CanShowHistory(importedMessages[i])) { DWORD ts = importedMessages[i].timestamp; while(itL != tempList.end() && itL->timestamp < ts)++itL; if (itL == tempList.end() || itL->timestamp > ts) { ti.exIdx = i; ti.timestamp = ts; tempList.insert(itL, ti); } } } } }
void ExportManager::AddGroup(bool isMe, const std::wstring &time, const std::wstring &user, const std::wstring &eventText, int ico) { if (exp == NULL) return; exp->WriteGroup(isMe, time, user, eventText); TCHAR str[MAXSELECTSTR + 8]; // for safety reason str[0] = 0; tm lastTime; bool isFirst = true; bool lastMe = false; EventData data; std::deque<EventIndex> revDeq; std::deque<EventIndex>& deq = eventList.back(); if (!oldOnTop && Options::instance->messagesNewOnTop) { revDeq.insert(revDeq.begin(), deq.rbegin(), deq.rend()); deq = revDeq; } for (std::deque<EventIndex>::iterator it = deq.begin(); it != deq.end(); ++it) { EventIndex hDbEvent = *it; if (GetEventData(hDbEvent, data)) { lastMe = data.isMe; TCHAR* formatDate = Options::instance->messagesShowSec ? _T("d s") : _T("d t"); TCHAR* longFormatDate = Options::instance->messagesShowSec ? _T("d s") : _T("d t"); if (!Options::instance->messagesShowDate) { if (isFirst) { isFirst = false; formatDate = Options::instance->messagesShowSec ? _T("s") : _T("t"); time_t tt = data.timestamp; localtime_s(&lastTime, &tt); } else { time_t tt = data.timestamp; tm t; localtime_s(&t, &tt); if (lastTime.tm_yday == t.tm_yday && lastTime.tm_year == t.tm_year) formatDate = Options::instance->messagesShowSec ? _T("s") : _T("t"); } } TimeZone_PrintTimeStamp(NULL, data.timestamp, longFormatDate, str , MAXSELECTSTR, 0); std::wstring longDate = str; TimeZone_PrintTimeStamp(NULL, data.timestamp, formatDate, str , MAXSELECTSTR, 0); std::wstring shortDate = str; std::wstring user; if (lastMe) user = myName; else user = contactName; GetEventMessage(hDbEvent, str); std::wstring strMessage = str; if (strMessage.length() + 1 >= MAXSELECTSTR) continue; if (hDbEvent.isExternal) GetExtEventDBei(hDbEvent); exp->WriteMessage(lastMe, longDate, shortDate, user, strMessage, gdbei); } } }
void DoPostExit() { int exitCode = GetEventData(); IDoExit(exitCode); }