ugtrain: unify dynmem buffer read/parsing