void visit(vector<vector<char>>& image, int x, int y, std::set<std::pair<int, int>>& visited) { //std::cout<<x<<" "<<y<<std::endl; minX = min(minX, x); maxX = max(maxX, x); minY = min(minY, y); maxY = max(maxY, y); if(x > 0 && image[x - 1][y] == '1' && visited.find(std::make_pair(x - 1, y)) == visited.end()) { visited.emplace(x - 1, y); visit(image, x - 1, y, visited); } if(y > 0 && image[x][y - 1] == '1' && visited.find(std::make_pair(x, y - 1)) == visited.end()) { visited.emplace(x, y - 1); visit(image, x, y - 1, visited); } if(x < m - 1 && image[x + 1][y] == '1' && visited.find(std::make_pair(x + 1, y)) == visited.end()) { visited.emplace(x + 1, y); visit(image, x + 1, y, visited); } if(y < n - 1 && image[x][y + 1] == '1' && visited.find(std::make_pair(x, y + 1)) == visited.end()) { visited.emplace(x, y + 1); visit(image, x, y + 1, visited); } }
void idm_get_set(std::set<u32>& out) { idm::select<T, Get>([&](u32 id, Get&) { out.emplace(id); }); }
bool ReportFixture(b2Fixture* fix) override { if ((fix->GetFilterData().maskBits & group) && (mask & fix->GetFilterData().groupIndex)) overlaps.emplace(static_cast<Collider2D*>(fix->GetBody()->GetUserData())); return true; }
static void scanLine(int _x0, int _x1, int _y, int _z, std::set<TileID>& _tiles) { for (int x = _x0; x < _x1; x++) { _tiles.emplace(x, _y, _z); } }
/* virtual methods from class LeScanCallback */ void OnLeScan(const char *address, const char *name) override { { std::string address2(address); if (addresses.find(address2) != addresses.end()) /* already in the list */ return; addresses.emplace(std::move(address2)); } { const ScopeLock protect(mutex); new_items.emplace_front(address, name); } Notify::SendNotification(); };
/* Try to map calc.exe into current process */ void MapCalcFromFile() { Process thisProc; thisProc.Attach( GetCurrentProcessId() ); nativeMods.clear(); modList.clear(); nativeMods.emplace( L"combase.dll" ); nativeMods.emplace( L"user32.dll" ); if (WinVer().ver == Win7) { nativeMods.emplace( L"gdi32.dll" ); nativeMods.emplace( L"msvcr120.dll" ); nativeMods.emplace( L"msvcp120.dll" ); } modList.emplace( L"windows.storage.dll" ); modList.emplace( L"shell32.dll" ); modList.emplace( L"shlwapi.dll" ); auto callback = []( CallbackType type, void* /*context*/, Process& /*process*/, const ModuleData& modInfo ) { if(type == PreCallback) { if(nativeMods.count(modInfo.name)) return LoadData( MT_Native, Ldr_None ); } else { if (modList.count( modInfo.name )) return LoadData( MT_Default, Ldr_ModList ); } return LoadData( MT_Default, Ldr_None ); }; std::wcout << L"Manual image mapping test" << std::endl; std::wcout << L"Trying to map C:\\windows\\system32\\calc.exe into current process" << std::endl; auto image = thisProc.mmap().MapImage( L"C:\\windows\\system32\\calc.exe", ManualImports | RebaseProcess, callback ); if (!image) { std::wcout << L"Mapping failed with error 0x" << std::hex << image.status << L". " << Utils::GetErrorDescription( image.status ) << std::endl << std::endl; } else std::wcout << L"Successfully mapped, unmapping\n"; thisProc.mmap().UnmapAllModules(); }
void setKeyPress(int key) { press_.emplace(key); }
void setKeyPull(int key) { pull_.emplace(key); }
void setKeyPush(int key) { push_.emplace(key); }
void setButtonPress(int button) { press_.emplace(button); }
void setButtonPull(int button) { pull_.emplace(button); }
void setButtonPush(int button) { push_.emplace(button); }
void add_location(const osmium::Location& location) { if (location.valid()) { m_dirty_tiles.emplace(m_zoom, location); } }