Doesn't really make sense - spoilers ahead Scene by scene it's all the usual Midsomer fun, slightly fewer murders than usual. This time the plot is derived from Hamlet, and for added frisson the play-within-a-play is ... Hamlet, starring Cully.
However, unlike the Bard's work, it doesn't make sense. Alan is murdered in Shanghai, and Ian discovers the motive after finding Alan's Chinese sketchbook with a pencilled note inside setting out his suspicions. But how did this happen? If Alan took the sketchpad on his Chinese trip, then why was it not incinerated in the car explosion? How did it get back to England, and in particular, how did it end up in his box of masonic regalia on top of the wardrobe? Who would remove it from his effects and hide it there in particular?
If, on the other hand, he didn't take it with him to China, that explains how it ended up on top of the wardrobe, but doesn't explain why he never mentioned his suspicions to anyone beforehand (e.g. His wife), or tried to prevent Charles' shady deals going through when actually in Shanghai.
Second, Tom - of course - gets the solution to the case on hearing Polonius' "method in his madness" line while watching Cully's performance, and rushes out. A day or two later, Cully is still mad at him - but by rushing out exactly when he did, Tom saved a life, never mind making his arrest. Did no-one explain this to Cully, or is she so up herself she only thinks of her own performances?
Third, there is no explanation for Ian's mad behaviour. His madness consists of sending Sophie/Ophelia off to a nunnery (or to the stock 'friend up North'), becoming an apparent convert to Charles' sneaky schemes, and telling his mother who the murderer is. There is no explanation for the first two of these, and no apparent reason why he doesn't share his information with the police.
So then why does Tom realise who did it when he hears the 'method in his madness' line, since there is no method in Ian's madness? If, say, Ian had drugged and killed himself to implicate Charles, having planted the seed of doubt in his mother, that might have made a bit more sense.
It would also have made more sense of the death of Peter, which, as it was, was just an accident. If Ian specifically wanted to destroy Charles and Peter, while disillusioning Hilary, he needed to be a bit more active than accidentally killing the one and being passively murdered by the other.
Fourth, surely wearing someone's cap and driving him around in the boot of his car leaves forensic traces? Hairs on the cap? Blood in the boot? Yet nothing is found, by this police force which must be the most experienced in murder investigations in the world.
And then, as the other reviewers point out, the complete lack of a resolution is a real problem. There must have been a better solution than this. It would be impossible to pin the Shanghai murder on Charles, with the lack of evidence (even given the autopsy). A neater ending would have given Tom something to play with. Had there been some method in Ian's madness, Ian might have provided it.