Uploaded yet another one.
I don't think i can do better about the small tearing appearing sometimes as the DMA transfer seems to overlap with the video ram during it's refresh.
It doesn't flicker or crash here when exiting so i don't know what's going on, the source is included anyway so if anyone knows how to fix that be my guest.
AFAIK, the LCD registers can't be read so the restored values are just a guess.
EDIT: i just noticed that it freezes at exit if USB isn't plugged, dunno why.
EDIT 2: Should be fixed now.