Example #1
0
    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);
        }
    }
Example #2
0
void idm_get_set(std::set<u32>& out)
{
	idm::select<T, Get>([&](u32 id, Get&)
	{
		out.emplace(id);
	});
}
Example #3
0
            bool ReportFixture(b2Fixture* fix) override
            {
                if ((fix->GetFilterData().maskBits & group) && (mask & fix->GetFilterData().groupIndex))
                    overlaps.emplace(static_cast<Collider2D*>(fix->GetBody()->GetUserData()));

                return true;
            }
Example #4
0
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);
    }
    
}
Example #5
0
  /* 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();
  };
Example #6
0
/*
    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();
}
Example #7
0
 void setKeyPress(int key) { press_.emplace(key); }
Example #8
0
 void setKeyPull(int key) { pull_.emplace(key); }
Example #9
0
 void setKeyPush(int key) { push_.emplace(key); }
Example #10
0
 void setButtonPress(int button) { press_.emplace(button); }
Example #11
0
 void setButtonPull(int button) { pull_.emplace(button); }
Example #12
0
 void setButtonPush(int button) { push_.emplace(button); }
 void add_location(const osmium::Location& location) {
     if (location.valid()) {
         m_dirty_tiles.emplace(m_zoom, location);
     }
 }