Converted screencap code to work using mmap()