Skip to content

Commit

Permalink
Take screenshot without tearing
Browse files Browse the repository at this point in the history
  • Loading branch information
DanTheMan827 committed Oct 26, 2017
1 parent 3afa3b7 commit 0b52942
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion WorkerForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,8 @@ public static Image TakeScreenshot()
var clovershell = MainForm.Clovershell;
var screenshot = new Bitmap(1280, 720, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
var rawStream = new MemoryStream();
clovershell.Execute("cat /dev/fb0", null, rawStream, null, 1000, true);
clovershell.Execute("hakchi uipause;cat /dev/fb0", null, rawStream, null, 1000, true);
clovershell.ExecuteSimple("hakchi uiresume");
var raw = rawStream.ToArray();
BitmapData data = screenshot.LockBits(
new Rectangle(0, 0, screenshot.Width, screenshot.Height),
Expand Down
12 changes: 12 additions & 0 deletions mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0010_functions
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,18 @@ uistart(){
/etc/init.d/S81clover-mcp start
}

uipause(){
lsof -n | grep /dev/fb0 | awk '{ print $1 }' | while read pid; do
kill -s SIGSTOP $pid
done
}

uiresume(){
lsof -n | grep /dev/fb0 | awk '{ print $1 }' | while read pid; do
kill -s SIGCONT $pid
done
}

gameover(){
poweroff
}
Expand Down

0 comments on commit 0b52942

Please sign in to comment.