Reimplemented preprocessing_hook support

This is needed for any sort of simulation that wants to tick with the device, i.e. the 3d api.