Revert "Reverted platform.h, part of it was pointless/illogical"

This reverts commit 723721f796cd50111635a9248af9834c6875f2bf.