set theory – Coding the universe into a real over better core models

One of the most incredible results in modern set theory, due to Jensen, is that given any model of $sf ZFC$, there is a class forcing which adds a real number $r$ and in the extension $V=L[r]$. Moreover, if we assume some basic things like $sf GCH$, then cardinals are not collapsed, so in particular things like inaccessible cardinals are preserved.

So in Jensen’s result the “coding model” is $L$. But $L[x]$ is somewhat of a dull model. It doesn’t have any sharps, measurable cardinals, or larger cardinals. Even those with reasonably canonical inner models.

Question. Given any reasonably canonical core model $K$, can we code the universe into a real over $K$ while preserving large cardinals that are captured by $K$?

In other words, can we code the universe into a real while preserving measurable cardinals? Can we code the universe into a real while preserving strong, Woodin, etc.?

And the obvious follow-up question, what is the bare minimum needed from an inner model $M$ to be a coding model?