I've been trying to extend your code to include time-varying transition probabilities. I think I've got it to work, which mainly involved a few changes to the coefficient structure and the Hamilton filter in the MS_Regress_Lik file. The only odd thing is that fmincon converges to local maxima that don't make sense, so I've used fminsearch instead.
It would be great if you could have a look at it to see whether what I've done makes any sense. Drop me an email (aw452@cam.ac.uk) if you're up for it.