fix win32 build, make tr1 stuff more general