Cosmological simulations of galaxy formation